Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- property myUser : "user-name"
- property myPass : "password"
- property defaultTimeZone : "America/Los_Angeles"
- on doSudoShellScript(myScript)
- return do shell script myScript user name myUser password myPass with administrator privileges
- end doSudoShellScript
- on getTimeZone()
- return doSudoShellScript("/usr/sbin/systemsetup -gettimezone")
- end getTimeZone
- on setTimeZone(timezone)
- return doSudoShellScript("/usr/sbin/systemsetup -settimezone " & timezone)
- end setTimeZone
- -- val is on|off
- on setUseNetworkTime(val)
- return doSudoShellScript("/usr/sbin/systemsetup -setusingnetworktime " & val)
- end setUseNetworkTime
- -- val is true|false
- on setAutoTimeZone(val)
- return doSudoShellScript("/usr/bin/defaults write /Library/Preferences/com.apple.timezone.auto Active -bool " & val)
- end setAutoTimeZone
- if (((getTimeZone()) as string) = "Time Zone: GMT") then
- setUseNetworkTime("on")
- setTimeZone("America/Chicago")
- setAutoTimeZone("true")
- display notification with title "TimeZone Changed" subtitle defaultTimeZone
- else
- setUseNetworkTime("off")
- setTimeZone("GMT")
- setAutoTimeZone("false")
- display notification with title "TimeZone Changed" subtitle "GMT"
- end if
- delay 1 --> allow time for the notification to trigger
Add Comment
Please, Sign In to add comment