Help regarding Airport Network Setup for Mac OS X

Hey guys,

I am really new to apple script and I need to make an apple script just to follow the following steps but I can’t figure it out… i would really appreciate some help:

  1. Click on the “airport” icon in the menu bar
  2. Select “join other network” and click on it
  3. In the Network Field enter a specific Network and,
  4. from the Security drop down list select 802.1x

Thanks for the help
mac_life

Model: Macbook pro
AppleScript: 2.2.1
Browser: Safari 528.16
Operating System: Mac OS X (10.5)

Hi,

try this


property NetworkName : "testNet"

tell application "System Events"
	tell process "SystemUIServer"
		tell (1st menu bar item of menu bar 1 whose value of attribute "AXDescription" contains "Airport")
			perform action "AXPress"
			delay 0.2
			perform action "AXPress" of menu item "Join Other Network." of menu 1
		end tell
		repeat until exists window 1
			delay 0.5
		end repeat
		tell window 1
			keystroke NetworkName
			tell pop up button 1
				click
				delay 0.2
				pick menu item "802.1X WEP" of menu 1
			end tell
		end tell
	end tell
end tell

OMG :smiley: IT works … Thanks Stefan :smiley:

That is very similar to what I need. I have a network card that is apparently flaking out . . . it runs fine if I click the Airport icon and choose “Open Network Preferences…” and manually choose the ssid of my router, but it won’t connect automatically.

What would I do for that for a script?

Thanks in advance.

d

Hi,

this might work in Leopard


property BSSID : "myNet"

tell application "Keychain Scripting" to set myKey to password of first key of current keychain whose name is BSSID
do shell script "/usr/sbin/networksetup setairportnetwork " & BSSID & space & myKey

Hey i have one quick question out there… in script below… when the script selects 802.1x, two text boxes appear Username and Password… how would one focus on the password text box… is it possible that the 802.1x pop up menu always remains “automatic”

Thanks


property NetworkName : "testNet"

tell application "System Events"
	tell process "SystemUIServer"
		tell (1st menu bar item of menu bar 1 whose value of attribute "AXDescription" contains "Airport")
			perform action "AXPress"
			delay 0.2
			perform action "AXPress" of menu item "Join Other Network." of menu 1
		end tell
		repeat until exists window 1
			delay 0.5
		end repeat
		tell window 1
			keystroke NetworkName
			tell pop up button 1
				click
				delay 0.2
				pick menu item "802.1X WEP" of menu 1
			end tell
			repeat until exists text field 2
				delay 0.5
			end repeat
			tell pop up button 2
				if value is not "Automatic" then
					click
					delay 0.2
					pick menu item "Automatic" of menu 1
				end if
			end tell
			set value of attribute "AXFocused" of text field 1 to true
		end tell
	end tell
end tell