Skip to content

Instantly share code, notes, and snippets.

@mono0x
Created October 18, 2011 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mono0x/1295244 to your computer and use it in GitHub Desktop.
Save mono0x/1295244 to your computer and use it in GitHub Desktop.
Create Network (for Lion)
property NetworkName : ""
property NetworkPassword : ""
try
do shell script "/usr/sbin/scselect " & NetworkName
delay 2
end try
tell application "System Events"
tell process "SystemUIServer"
tell menu bar 1
set menu_extras to value of attribute "AXDescription" of menu bar items
repeat with the_menu from 1 to the count of menu_extras
-- if item the_menu of menu_extras is "AirMac Menu Extra" then exit repeat
if item the_menu of menu_extras begins with "Wi-Fi" then exit repeat
end repeat
tell menu bar item the_menu
perform action "AXPress"
delay 0.2
perform action "AXPress" of menu item "ネットワークを作成..." of menu 1
end tell
end tell
repeat until exists window 1
delay 0.5
end repeat
tell window 1
keystroke NetworkName
click pop up button 2
click menu item 4 of menu 1 of pop up button 2
keystroke NetworkPassword
keystroke tab
keystroke NetworkPassword
delay 0.5
click button 1
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment