Created
August 22, 2012 19:16
-
-
Save Haraguroicha/3428514 to your computer and use it in GitHub Desktop.
Internet Sharing preferences flipper for zh-TW Mac OS X
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
set preferencesWindowTitle to "共享" | |
set btnOpenWiFi to "開啟 Wi-Fi" | |
set btnActivate to "啟動" | |
set successfulText to "Internet 共享已經成功切換" | |
set someWrongText to "Oops...有些錯誤噢~!" | |
set btnOK to "好" | |
tell application "System Preferences" | |
activate | |
reveal (pane id "com.apple.preferences.sharing") | |
end tell | |
tell application "System Events" | |
tell process "System Preferences" | |
try | |
click checkbox of row 8 of table 1 of scroll area 1 of group 1 of window preferencesWindowTitle | |
if checkbox of row 8 of table 1 of scroll area of group 1 of window preferencesWindowTitle is equal to 1 then | |
repeat until sheet of window 1 exists | |
delay 0.5 | |
end repeat | |
end if | |
try | |
if (sheet of window 1 exists) then | |
click button btnOpenWiFi of sheet of window 1 | |
end if | |
end try | |
if (sheet of window 1 exists) then | |
click button btnActivate of sheet of window 1 | |
end if | |
activate (display dialog successfulText buttons {btnOK} with icon note) | |
delay 1 | |
on error | |
activate | |
display dialog someWrongText buttons {btnOK} with icon stop | |
return false | |
end try | |
end tell | |
end tell | |
tell application "System Preferences" to quit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment