Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tell application "System Preferences"
- activate
- end tell
- tell application "System Events"
- tell process "System Preferences"
- click menu item "Sharing" of menu "View" of menu bar 1
- delay 2
- tell window "Sharing"
- if (value of checkbox 1 of row 9 of table 1 of scroll area 1 of group 1 is 1) then
- click checkbox 1 of row 9 of table 1 of scroll area 1 of group 1
- try
- set makiaeawirelessstatus to do shell script "networksetup -getairportpower en1"
- on error
- display dialog "The script did not work as intended, please check the networksetup command (in terminal) works on your system. It has been tested on mac os 10.7 (Build 11A459e). Other versions of mac os may not have this command available. Please open the applescript in applescript editor for more details." buttons {"kthxbai"}
- end try
- if makiaeawirelessstatus is "Wi-Fi Power (en1): On" then
- do shell script "networksetup -setairportpower en1 off"
- else
- display dialog "The script did not work as intended, please check the networksetup command (in terminal) works on your system. It has been tested on mac os 10.7 (Build 11A459e). Other versions of mac os may not have this command available. Please open the applescript in applescript editor for more details." buttons {"kthxbai"}
- end if
- else
- click checkbox 1 of row 9 of table 1 of scroll area 1 of group 1
- delay 1
- if (exists sheet 1) then
- if (exists button "Turn Wi-FI On" of sheet 1) then
- click button "Turn Wi-Fi On" of sheet 1
- delay 1
- end if
- click button "Start" of sheet 1
- end if
- end if
- end tell
- end tell
- delay 2
- end tell
- if application "System Preferences" is running then
- tell application "System Preferences" to quit
- end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement