• 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: Jim Brandt <email@hidden>
  • Date: Fri, 18 Jul 2008 08:46:48 -0500

Bill,

Thanks for the reply.

I'm running Safari 3.1.2 on OS X 10.4.11 on a dual 450 PowerPC. Leopard isn't an option.

With UI Browser, the path to the landscape button shows as:

PATH TO ELEMENT:
  application "Safari"
    standard window "Jim's Place" (window 1)
      Sheet "Page Setup" (sheet 1)
        [MISMATCH] radio group (radio group -2147483648)
           button "" (button 2)

I've tried this:

tell application "System Events"
tell process "Safari"
click menu item "New Window" of menu 1 of menu bar item "File" of menu bar 1
delay 1
click menu item "Page Setup…" of menu 1 of menu bar item "File" of menu bar 1
click button 2 of radio group of sheet 1 of front window
keystroke return
end tell
end tell


The page setup dialog comes up but it doesn't change to landscape mode.
if I use:
		click button 2 of radio group 1 of sheet 1 of front window
I get a System Events error.

Am I just out of luck on this one?

BTW, OT, is there a way to capture the text in the Screen Reader window of UI Browser?

Thanks,

Jim Brandt


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
  • Follow-Ups:
    • Re: UI scripting question
      • From: Axel Luttgens <email@hidden>
    • Re: UI scripting question
      • From: Bill Cheeseman <email@hidden>
  • Prev by Date: Re: Anyone here using source control?
  • Next by Date: Re: Authentication scripting
  • Previous by thread: Re: UI scripting question
  • Next by thread: Re: UI scripting question
  • Index(es):
    • Date
    • Thread