We Recommend

Beginning AppleScript (Programmer to Programmer) Beginning AppleScript (Programmer to Programmer)
Geared toward programmers with no prior development knowledge, Beginning AppleScript serves as a comprehensive guide to using AppleScript on the Mac OS X platform. This title introduces the reader to AppleScript, and then illustrates how to efficiently start writing scripts through sample programs as each concept is introduced.


Ballyhoo


Posted By

heinz1959 on 12/11/07


Tagged

applescript macosx set clock


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

sbbath


MacOS X - set correct time AppleScript


Published in: AppleScript 


  1. (*
  2. The MacOS X clock is NOT set properly
  3. unless the Date & Time PrefPane is opened.
  4. *)
  5.  
  6. -- Open the Date & Time PrefPane
  7. do shell script "/usr/bin/open /System/Library/PreferencePanes/DateAndTime.prefPane"
  8.  
  9. -- Keep it open for a couple of seconds
  10. do shell script "/bin/sleep 10"
  11.  
  12. -- Close the SysPrefs
  13. quit application "System Preferences"
  14.  
  15. (*
  16. Done.
  17. The clock should be set correctly now.
  18. *)
  19.  
  20. (*
  21. When saved as an application,
  22. this script can be used to set the clock on startup.
  23.  
  24. Place it anywhere you like and add it to
  25. the startup items in the Users PrefPane.
  26. *)

Report this snippet 

You need to login to post a comment.