2 Replies Latest reply: May 11, 2012 2:49 PM by twtwtw
Rick Jiang Level 1 Level 1 (0 points)

In my office,we have three Wi-Fi connection A,B,C.I had connected them in store the password in keychain.For now,i want to create a applescript to auto connect them by one click.Like i click application A,then it will help me to connect to A Wi-Fi and so on.

But,after i searched many knowledge from web,the code maybe not work on lion.

 

tell application "Keychain Script"

  set serverKey to frist key of current keychain whose name is "EUCMAC"

  set acct to account of serverKey

  set pswd to password of serverKey

end tell

 

Could somebody help me on this case?

 

Thanks.

 

Rick Jiang


iMac, Mac OS X (10.7.3)
  • 1. Re: How to use stored keychain to change Wi-Fi connection
    MrHoffman Level 6 Level 6 (12,470 points)

    Not what you're asking and obviously a guess as to why you're doing this (and why you need this isn't stated)... 

     

    Switch all three WiFi devices over to access point (what Apple calls "bridging") configurations and eliminate this particular complexity from your network? 

     

    Not the answer to the direct question, but this'll work for one of the more common reasons folks ask this, and it'll make end-user operations in your network easier.   One password across all.  And this also allows roaming across access points without having to reset the connections, for instance.

  • 2. Re: How to use stored keychain to change Wi-Fi connection
    twtwtw Level 5 Level 5 (4,690 points)

    why not set up three different locations, one for each WiFi connection? (System Preferences -> Network Preferences -> unlock and choose Edit Locations from the locations pull down.)  If I remember right, it's easy to script a location change.