Guest User

Untitled

a guest
Sep 5th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. property myUser : "user-name"
  2. property myPass : "password"
  3. property defaultTimeZone : "America/Los_Angeles"
  4.  
  5. on doSudoShellScript(myScript)
  6. return do shell script myScript user name myUser password myPass with administrator privileges
  7. end doSudoShellScript
  8.  
  9. on getTimeZone()
  10. return doSudoShellScript("/usr/sbin/systemsetup -gettimezone")
  11. end getTimeZone
  12.  
  13. on setTimeZone(timezone)
  14. return doSudoShellScript("/usr/sbin/systemsetup -settimezone " & timezone)
  15. end setTimeZone
  16.  
  17. -- val is on|off
  18. on setUseNetworkTime(val)
  19. return doSudoShellScript("/usr/sbin/systemsetup -setusingnetworktime " & val)
  20. end setUseNetworkTime
  21.  
  22. -- val is true|false
  23. on setAutoTimeZone(val)
  24. return doSudoShellScript("/usr/bin/defaults write /Library/Preferences/com.apple.timezone.auto Active -bool " & val)
  25. end setAutoTimeZone
  26.  
  27. if (((getTimeZone()) as string) = "Time Zone: GMT") then
  28. setUseNetworkTime("on")
  29. setTimeZone("America/Chicago")
  30. setAutoTimeZone("true")
  31. display notification with title "TimeZone Changed" subtitle defaultTimeZone
  32. else
  33. setUseNetworkTime("off")
  34. setTimeZone("GMT")
  35. setAutoTimeZone("false")
  36. display notification with title "TimeZone Changed" subtitle "GMT"
  37. end if
  38. delay 1 --> allow time for the notification to trigger
Add Comment
Please, Sign In to add comment