• 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: Scripting the Location
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting the Location


  • Subject: Re: Scripting the Location
  • From: "John C. Welch" <email@hidden>
  • Date: Sat, 30 Aug 2003 11:43:12 -0400

On 08/28/2003 19:34, "John Delacour" <email@hidden> wrote:

>>
>> tell application "Finder" to activate
>> tell application "System Events"
>> tell process "Finder"
>> click menu item "Home" of menu "Location" of menu item
>> "Location" of menu "Apple" of menu bar 1
>> end tell
>> end tell
>
>
> I find I have to do something like this, which is clearly not the way
> it should be. I've replaced the names with numbers just so things
> fit on the line.

There is a far easier way to script network changes than UI scripting. You
use the 'scselect' utility with a "do shell script" statement.

If you open terminal, and just enter scselect, it lists all your locations,
giving each a numerical index starting at 0. scselect indexnumber changes to
that location. Examples below.

[localhost:~] jwelch% scselect
Defined sets include: (* == current set)
* 0 (Home)
1 (MIT)

[localhost:~] jwelch% scselect 1
CurrentSet updated to 1 (MIT)
[localhost:~] jwelch% scselect 0
CurrentSet updated to 0 (Home)

I'd recommend this over UI scripting.

FAR less work and less fragile too.

john

--
Magister Mundi sum!
(I am the Master of the Universe!)
_______________________________________________
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.

  • Follow-Ups:
    • Re: Scripting the Location
      • From: Paul Berkowitz <email@hidden>
    • Re: Scripting the Location
      • From: Gnarlodious <email@hidden>
    • Re: Scripting the Location
      • From: Craig Sutherland <email@hidden>
    • Re: Scripting the Location
      • From: Paul Berkowitz <email@hidden>
References: 
 >Re: Scripting the Location (From: John Delacour <email@hidden>)

  • Prev by Date: Re: Safari: getting name of document
  • Next by Date: Safari
  • Previous by thread: Re: Scripting the Location
  • Next by thread: Re: Scripting the Location
  • Index(es):
    • Date
    • Thread