System Time Zone

Bob Cole bobcole at earthlink.net
Wed Sep 14 09:50:01 EDT 2022


Just for the sake of completeness, there is a way to get the time zone with AppleScript but it requires Administrator Privileges. The MacOS pops up a request to allow the “do as AppleScript” script to access the systemsetup function. That manual step will interfere with the flow of the program.

Create a field “Statements” with this AppleScript:

do shell script "/usr/sbin/systemsetup -gettimezone" with administrator privileges

and put the following code in the script of a button:

on mouseUp
   do field "Statements" as "AppleScript"
   put the result into tResult
   set the itemDelimiter to space
   delete word 1 to 2 in tResult
   delete the last char of tResult
   put tResult into message box
end request

Tested in two time zones with these results: 
America/Chicago
America/New_York

Bob

> It's the, "America/Los_Angeles" bit I am trying to find a way to grok.


More information about the use-livecode mailing list