Re: Scripting the Location
Re: Scripting the Location
- Subject: Re: Scripting the Location
- From: Irwin Poche <email@hidden>
- Date: Fri, 29 Aug 2003 12:23:26 -0500
Thanks Craig,
What I now realize is that when the Finder is not active (had been
previously Quit) the time it takes to activate has to be allowed for in a
delay. That is why UI scripting the Location menu was problematic. My
scripting the Apple>Location menu is reliable when a delay is added.
But I prefer your method which I have been unable to completely understand.
What I have not yet figured out from your script is how you tell the popup
what to select. That does not appear to be doable explicitly in UI
scripting, at least accord to what the UI Browser will generate. I've tried
to whittle your script down to an illustrative example with no luck. This
gets an NSReceiverEvaluationScriptError: 4 error on the "click" line
-- Assume that Sys Pref is running with Network pane already selected
tell application "System Events"
tell process "System Preferences"
tell pop up button 1 of window "Network"
tell menu 1
delay 1
click menu item "Office"
end tell
end tell
end tell
end tell
If you could distill your script down to a simple example, I would benefit.
I'm guessing the rest of the list would too.
-Irwin
On 8/29/03 11:06 AM, Craig Sutherland said:
>
>
On Friday, August 29, 2003, at 10:34 AM, Irwin Poche wrote:
>
>
> >
>
> > I understand what you're saying about the Finder and Systems
>
> > Preferences.
>
> >
>
> > But you are doing essentially what I'm doing, setting the Location
>
> > from the
>
> > Finder's menu.
>
>
I don't refer to the Finder at all. The script does not use the
>
Location menu item of the Finder's menu.
>
> > That is what I have found to be unreliable. Sometimes it
>
> > works, sometimes it doesn't. When it has not worked UI Browser show no
>
> > choices available for the Location menu.
>
The script I sent is reliable. Have you tried it?
>
>
> > Also, what would be the reason for using Systems Preferences to
>
> > determine
>
> > the current Location and then decide if it was to be changed? That
>
> > takes
>
> > longer than just setting it to what it is going to be (or all ready
>
> > is).
>
>
The Network Preference Pane has the information about networks
>
connections, Finder does not. The Locations menu item is in the Apple
>
menu as a convenience, just as the Dock menu item is. Those menu items
>
call the functionality of the Dock or Network Preference Pane. The
>
Apple menu is persistent in all applications- when you are in Mail.app,
>
the Apple Menu is present and Mail.app has nothing to do with the
>
Finder. Switch to any application, and the Apple Menu is still present
>
plus the menus for that application. You may associate the Apple menu
>
with the Finder because you frequently have the Finder as the active
>
application.
>
>
The Finder.app is just that, an application that has certain objects
>
and methods. Some of Finder's functions have been added to the Apple
>
Menu for easy access, just as the Network Preference Pane has been.
>
Have you looked in the Finder's Applescript Dictionary? The
>
dictionaries are the source of what capabilities each application has
>
that are scriptable. Classes are descriptions of the objects that can
>
be interacted with, for instance the folder object, the file object,
>
the window object, the application file object. Commands are events or
>
actions applied or given to objects, for instance copy, sort, restart,
>
eject, update.
>
>
Take a look at the System Events dictionary. This is a much larger
>
suite of objects and events. As the Finder is being deprecated, System
>
Events is the application that is replacing it in part.
>
>
Let me know if this helps.
>
>
Craig
_______________________________________________
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.