Why does AppleScript "exists" sometimes always return "false"? (part of question regarding checking documents in Pages)
This following AppleScript code should work for you.  Ultimately, this code sets a variable for the count of open documents in Pages (openDocuments)  Then if the count of openDocuments is not 0, the names of the open documents are stored in this variable openDocumentNames

if application "Pages" is not running then
    tell application "Pages" to activate
    tell application "System Events" to tell application process "Pages"
        repeat until frontmost
            delay 0.1
        end repeat
    end tell
end if

tell application "Pages"
    set openDocumentsRef to a reference to documents
    set openDocuments to count of openDocumentsRef
    if openDocuments is not 0 then
        -- Gets The Name Of The Open Files
        set openDocumentNames to name of openDocumentsRef
        -- Gets The File Paths To The Open Files
        set openDocumentsPaths to file of openDocumentsRef
    end if
end tell

-- Shows &amp; Selects The Files In A New Finder Window
tell application "Finder" to reveal openDocumentsPaths