Created
January 20, 2012 19:40
-
-
Save PatrickTulskie/1649172 to your computer and use it in GitHub Desktop.
Create an adhoc network with your WiFi card on Lion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
property NetworkName : "adhoc_network" | |
property NetworkPassword : "password" | |
property CreateMenuName : "Create Network…" | |
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 contains "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 CreateMenuName of menu 1 | |
end tell | |
end tell | |
repeat until exists window 1 | |
delay 0.5 | |
end repeat | |
tell window 1 | |
keystroke NetworkName | |
keystroke tab | |
keystroke tab | |
click pop up button 2 | |
click menu item 4 of menu 1 of pop up button 2 | |
delay 0.5 | |
keystroke NetworkPassword | |
keystroke tab | |
keystroke NetworkPassword | |
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