Im completely new to applescript so take it easy on me please.
Issue is that I need to change the airport wep password each day as customers at a cafe are given this for free and then turn up outside (not buying coffee!) day after day sucking up the bandwidth. Thought perhaps I could get applescript to suck the values out of a csv tab delimited file depending on the day of the month. So on the 1st the wep password would be 0123456789, the 2nd 9998887771 etc.
I did read on a post that airport admin utility is not very scriptable so is this a non-starter?
The Airport Admin Utility is not scriptable at all except by using System Events to script its GUI. I don’t have an AirPort (so for me it sticks at the select base station window), but someone who does can lead you through the steps to reconfiguring it if the GUI is relatively straight-forward.
Airport Utility isn’t really scriptable, but with GUI scripting you can do it.
It works only with Airport Utility Version 5
There is a dummy handler getNewPass(), you must replace is with your routine to get the data
property baseStation : "myStation"
property pass_word : "¢¢¢¢¢¢"
set newPass to getNewPass() -- dummy handler to get passwort from .csv
activate application "AirPort Utility"
if character 1 of (get version of application "AirPort Utility") as integer < 5 then return -- Versioncheck
tell application "System Events"
tell process "AirPort Utility"
tell window 1
tell (1st row of table 1 of scroll area 1 whose value of text field 1 is baseStation)
set value of attribute "AXSelected" to true
end tell
keystroke "l" using command down
set x to 20 -- delay if password is taken from keychain and sheet doesn't appear
repeat until (exists sheet 1) or (x is 0)
delay 0.5
set x to x - 1
end repeat
if x > 0 then
tell sheet 1
keystroke pass_word
delay 0.5
click button "OK"
end tell
end if
repeat until exists tab group 1
delay 0.5
end repeat
tell tab group 1
click radio button "Base Station"
repeat until button "Base Station Options." exists
delay 0.5
end repeat
set value of attribute "AXFocused" of text field 2 to true
keystroke newPass & tab & newPass
end tell
delay 0.5
click button "Update"
repeat until (exists group 1) and (value of static text 1 of group 1 contains "You can close")
delay 0.5
end repeat
end tell
end tell
end tell
quit application "AirPort Utility"