System Time Zone

matthias_livecode_150811 at matthias_livecode_150811 at
Wed Sep 14 11:09:00 EDT 2022

Does your app has preferences the user can enter? Why not allow him to enter also the sudo password?
You could then use that to execute the following shell command:

put shell("echo <password> | sudo -S /usr/sbin/systemsetup -gettimezone")

replace <password> with the password in preferences. No need to use Applescript.


> Am 14.09.2022 um 15:50 schrieb Bob Cole via use-livecode <use-livecode at>:
> 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.
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the use-livecode mailing list