Alex,

Hopefully this will help…
I ran 

tell application "Pages"
        
        set current_window to window 1
        set itemList to documents of current_window
        repeat with anitem in itemList
                get the class of item 1 of anitem
        end repeat
end tell


and received the results:
tell application "Pages"
        get window 1
                --> window id 888
        get every document of window id 888
                --> document id "018F988E-C58F-43F2-BD69-9567F7F9FEE7"
        count document id "018F988E-C58F-43F2-BD69-9567F7F9FEE7"
                --> 1
        get class of item 1 of item 1 of document id 
"018F988E-C58F-43F2-BD69-9567F7F9FEE7"
                --> document
end tell
Result:
document

> On Feb 22, 2016, at 21:04, Alex Hall <mehg...@icloud.com> wrote:
> 
> Hey list,
> Anyone else out there who plays with AppleScript, I'd love your help. I'm 
> trying to help someone automate the completion of some long forms in Pages, 
> and I know how I'm going to do it. The problem is that even the simplest 
> script errors out with "Pages got an error: can't get document 1". If I can't 
> access the document, it's not going to work at all. Yet, I have no clue why I 
> can't, and all the samples I've looked up do exactly what I do. I even used 
> one of the samples, straight from the web, and got the exact same error. It 
> has to be something funny locally, but I don't know what. I don't even know 
> where to look. Any suggestions will be appreciated. Thanks.
> 
> --
> Have a great day,
> Alex Hall
> mehg...@icloud.com
> 
> -- 
> The following information is important for all members of the Mac Visionaries 
> list.
> 
> If you have any questions or concerns about the running of this list, or if 
> you feel that a member's post is inappropriate, please contact the owners or 
> moderators directly rather than posting on the list itself.
> 
> Your Mac Visionaries list moderator is Mark Taylor and your owner is Cara 
> Quinn - you can reach Cara at caraqu...@caraquinn.com
> 
> The archives for this list can be searched at:
> http://www.mail-archive.com/macvisionaries@googlegroups.com/
> --- 
> You received this message because you are subscribed to the Google Groups 
> "MacVisionaries" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to macvisionaries+unsubscr...@googlegroups.com.
> To post to this group, send email to macvisionaries@googlegroups.com.
> Visit this group at https://groups.google.com/group/macvisionaries.
> For more options, visit https://groups.google.com/d/optout.

-- 
The following information is important for all members of the Mac Visionaries 
list.

If you have any questions or concerns about the running of this list, or if you 
feel that a member's post is inappropriate, please contact the owners or 
moderators directly rather than posting on the list itself.

Your Mac Visionaries list moderator is Mark Taylor and your owner is Cara Quinn 
- you can reach Cara at caraqu...@caraquinn.com

The archives for this list can be searched at:
http://www.mail-archive.com/macvisionaries@googlegroups.com/
--- 
You received this message because you are subscribed to the Google Groups 
"MacVisionaries" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to macvisionaries+unsubscr...@googlegroups.com.
To post to this group, send email to macvisionaries@googlegroups.com.
Visit this group at https://groups.google.com/group/macvisionaries.
For more options, visit https://groups.google.com/d/optout.

Reply via email to