Scripting Page Setup
Scripting Page Setup
- Subject: Scripting Page Setup
- From: Bill Monk <email@hidden>
- Date: Fri, 5 Mar 2004 15:41:32 -0600
Is it possible to script Page Setup dialogs and sheets?
Have been attempting it with GUI events. It's
easy enough to get the Page Setup dialog to open.
Next, I'd like the script to select a paper size.
Using (say) Safari as an example, and with the Page
Setup sheet already open to simplyfy things here,
this script
tell app "Safari"
-- Page Setup is already open
tell application "System Events"
click menu item "Tabloid" of menu 1 of pop up button 1 of UI element
1 of UI element 3 of sheet "Page Setup" of front window of process
"Safari"
end tell
end tell
returns "System Events got an error
NSReceiverEvaluationScriptError: 4"
I got this particular construction from a demo of UI Browser 1.2.
Using Apples GUI Scripting doc pages and UI Element Inspector to
get this
tell application "System Events"
tell process app_name
tell front window
tell sheet "Page Setup"
tell UI element 3
tell UI element 1
pop up button 1
tell menu 1
click menu item "A4" of menu 1
end tell
end tell
end tell
end tell
end tell
end tell
end tell
produces the same error.
Is this totally off base?
The UI Browser docs suggest that if there are unnamed
elements in the heirarchy, like "UI element 3", it work.
But if UI Browser and UI Element Inspector can display them,
it seems that referring to them by number should be OK if
they don't have names...
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.