• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UI scripting question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UI scripting question


  • Subject: Re: UI scripting question
  • From: John Baltutis <email@hidden>
  • Date: Thu, 17 Jul 2008 12:55:14 -0700

On 7/17/08, Bill Cheeseman <email@hidden> wrote:
> 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

FYI. Ran that script in Script Editor and got this:

tell application "Safari"
	activate
end tell
tell application "System Events"
	keystroke "n" using {command down}
	keystroke "http://www.google.com";
	keystroke "
"
	keystroke "p" using {command down}
	click checkbox 2 of radio group 1 of sheet 1 of window 1 of process "Safari"
		"System Events got an error: Can't get sheet 1 of window 1 of process
\"Safari\". Invalid index."

10.5.4 w/Safari 3.1.2. Also tried running as app and bundled app with the same
error. BTW, the keystroke "http://www.google.com"; line doesn't override the
homepage setting, so is unnecessary. Ideas?
 _______________________________________________
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

  • Follow-Ups:
    • Re: UI scripting question
      • From: Bill Cheeseman <email@hidden>
  • Prev by Date: Re: UI scripting question
  • Next by Date: RE: Simple Display Dialog confusion
  • Previous by thread: Re: UI scripting question
  • Next by thread: Re: UI scripting question
  • Index(es):
    • Date
    • Thread