Re: UI scripting question
Re: UI scripting question
- Subject: Re: UI scripting question
- From: Bill Cheeseman <email@hidden>
- Date: Thu, 17 Jul 2008 12:44:04 -0400
- Thread-topic: UI scripting question
on 2008-07-16 4:13 PM, Jim Brandt at email@hidden wrote:
> I'm guessing that I haven't fully defined the path to the landscape button,
> but how
> do you define it when it's not named?
You use its index reference form, as you did. Your script is erroring on
something else, I think; maybe the Page Setup menu item is disabled when the
front window hasn't yet been directed to a Web site, or maybe clicking the
orientation buttons don't work in the versions you're using. This works, in
Safari 3.1.2 in Mac OS X 10.5.4:
activate application "Safari"
tell application "System Events"
tell process "Safari"
keystroke "n" using {command down} -- open new window
keystroke "http://www.google.com"
keystroke return
delay 1
keystroke "p" using {command down} -- open print sheet
click checkbox 2 of radio group 1 of sheet 1 of front window
end tell
end tell
You will have to adjust that if you're using an older version of Safari or
Mac OS X. The latest version of Safari no longer has a Page Setup menu item
or dialog/sheet, at least when running under Leopard, because the old page
setup stuff is consolidated in the Print dialog in applications that take
advantage of Leopard's new printing facilities, like Safari.
By the way, you're doing way too much work in your script. Instead of
testing whether Safari is running or frontmost, just start the script with
this command:
activate application "Safari"
That will launch Safari if it isn't running, and bring it to the front if it
is.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com
PreFab Software - www.prefabsoftware.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden