Re: UI Scripting menu items
Re: UI Scripting menu items
- Subject: Re: UI Scripting menu items
- From: Bill Cheeseman <email@hidden>
- Date: Thu, 10 Apr 2003 08:51:25 -0400
on 03-04-09 11:22 PM, Ken Liu at email@hidden wrote:
>
I'm running into two problems
>
>
1. Sometimes the list of network locations is not properly populated.
>
I have "Home" and "School" defined as locations, but sometimes only
>
"Network Preferences..." shows up as a choice in the location_list. At
>
other times, all the menu items do show up. I've put delay calls in
>
all sorts of places and can't find a consistent pattern. How can I
>
make it work consistently?
>
>
2. This is the bigger problem: even when the script seems to "work" it
>
does not. The script terminates but I'm still in the Finder, rather
>
than back in the current_process as I expect. And here's the thing
>
that really baffles me, _until_ I click on the apple menu myself, the
>
network location is not in fact switched! In other words, the script
>
seems to "queue" up the clicking action and not execute it until I
>
manually go and click on the apple menu itself, at which point it goes
>
ahead and performs the UI action it's supposed to. This is best seen
>
when I select the "Network Preferences..." option. The Finder just
>
sits there and does nothing until I click on the apple menu, and the
>
moment I do the Network Preference pane launches.
>
>
And if I switch to another application before I click on the apple
>
menu, the script simply does not do anything.
>
>
I've changed the delay time with no improvement.
>
>
Any suggestions on how I can get this script to do its thing instead of
>
just queuing up the "click"?
This kind of behavior generally has to do with the way the system and
individual target applications handle menus and menu items. A menu often is
not populated until the user clicks on it to open it. This is because many
menus are dynamic -- they are supposed to change to reflect the current
state of the application -- and they cannot know what content they should
show until the moment they are clicked.
The best way to try to control this is to include a command in your script
that opens the menu holding the menu item of interest, in order to let the
target application determine the proper current contents of the menu. It
doesn't always work, but I believe it sometimes does.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
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.