Re: Stuck with GUI scripting
Re: Stuck with GUI scripting
- Subject: Re: Stuck with GUI scripting
- From: Bill Cheeseman <email@hidden>
- Date: Mon, 12 Dec 2005 05:49:50 -0500
- Thread-topic: Stuck with GUI scripting
on 2005-12-12 12:35 AM, Brett Conlon at email@hidden wrote:
> I'm trying to select the "FreeHand MX" menu item of the pop up button (1) of
> the Print window but nothing is happening further than the Print window
> appearing.
>
> Here's the code:
>
> tell application "FreeHand MX"
> activate
> tell document 1
> print
> tell application "System Events"
> tell process "FreeHand MX"
> click menu item "FreeHand MX" of pop up button 1
> of window "Print"
> end tell
> end tell
> end tell
> end tell
With pop-up menus, you usually have to click the menu button first in order
to open it, then click the menu item. Depending on the speed of your
machine, you may have to insert a 'delay 1' command between the two to give
the menu time to open.
> ps. when and how do you use the AX actions? I've seen them in a few scripts on
> the list but how do they differ from say the click command etc.?
There are two fairly rare situations where 'perform action' is useful. One
is where the target application does not respond to the usual command, such
as 'click'. It is always worth trying the 'perform action' version of the
same command, 'perform action "AXPress"', because in some apps that will
work. The other is with newer commands that don't have an AppleScript-style
synonym, or special actions implemented by the application that are not part
of the standard accessibility API.
Historically, the initial implementation of GUI Scripting (the Jaguar beta
release) focused on traditional AppleScript-style terminology. The 'perform
action' command came along later to generalize GUI Scripting so that it
could handle all actions implemented by all applications.
> pps. I strangely have a ghost of the "Copies & Pages" pop up that won't go
> away since trying these (as well as the perform action AXPress). No doubt a
> reboot will clear it but I've never seen remnants hang around like this under
> OSX before.
I've never heard of this before, that I recall. I expect that quitting and
relaunching the application might fix it.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden