I used records to return what I assumed to be self explanatory results.
A well known example is the record returned by:
set aRecord to display dialog "what's your first name" default answer "Yvan"
--> {button returned:"OK", text returned:"Yvan"}
display dialog "You clicked the button : " & button returned of aRecord & linefeed & "You type the first name : " & text returned of aRecord
The final result is the dialog displaying:
“You clicked the button : OK
You type the first name : Yvan”
The result of my first script would have been deciphered with:
use AppleScript version "2.5"
use scripting additions
use framework "Foundation"
on timeZoneInfo()
set thisZone to current application's NSTimeZone's localTimeZone()
set theName to thisZone's |name|() as text
set theAbbr to thisZone's abbreviation() as text
set theOffset to thisZone's daylightSavingTimeOffset()
set isDST to thisZone's isDaylightSavingTime() as boolean
return {zone_Name:theName, zone_Abbr:theAbbr, zone_Offset:theOffset, isDaylightSavingTime:isDST}
end timeZoneInfo
set aRecord to my timeZoneInfo()
display dialog "The current timeZone name is : " & zone_Name of aRecord & linefeed & "The current timeZone abbreviated descriptor is : " & zone_Abbr of aRecord & linefeed & "The current daylightSavingTimeOffset : " & zone_Offset of aRecord & linefeed & "The current isDaylightSavingTime is : " & isDaylightSavingTime of aRecord
Here it displayed:
“The current timeZone name is : Europe/Paris
The current timeZone abbreviated descriptor is : UTC+1
The current daylightSavingTimeOffset : 0,0
The current isDaylightSavingTime is : false”
With the short one :
use AppleScript version "2.5"
use scripting additions
use framework "Foundation"
on timeZoneInfo()
set thisZone to current application's NSTimeZone's localTimeZone()
return {isDaylightSavingTime:thisZone's isDaylightSavingTime() as boolean}
end timeZoneInfo
set aRecord to my timeZoneInfo()
display dialog "The current isDaylightSavingTime is : " & isDaylightSavingTime of aRecord
which displayed : “The current isDaylightSavingTime is : false”
As Shane wrote, we may return a single value or a list of values:
use AppleScript version "2.5"
use scripting additions
use framework "Foundation"
on timeZoneInfo()
set thisZone to current application's NSTimeZone's localTimeZone()
set theName to thisZone's |name|() as text
set theAbbr to thisZone's abbreviation() as text
set theOffset to thisZone's daylightSavingTimeOffset()
set isDST to thisZone's isDaylightSavingTime() as boolean
return {theName, theAbbr, theOffset, isDST}
end timeZoneInfo
set {zone_Name, zone_Abbr, zone_Offset, isDaylightSavingTime} to my timeZoneInfo()
display dialog "The current timeZone name is : " & zone_Name & linefeed & "The current timeZone abbreviated descriptor is : " & zone_Abbr & linefeed & "The current daylightSavingTimeOffset : " & zone_Offset & linefeed & "The current isDaylightSavingTime is : " & isDaylightSavingTime
I wish to add that I am always surprised when askers don’t take care to test the COMPLETE code posted by helpers.
We aren’t paid according to the number of characters in our codes.
It would be logical to assume that if something is written, it’s because it’s USEFUL !
The button [Open this Scriplet in your Editor:] is delivered to help you to grab the true script with no typo.
In an other Web area where we share code too, such button is missing from time to time and it’s annoying :rolleyes:
Last words, I forgot to write that my first proposals were based upon code written by Shane Stanley.
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 10 mars 2020 10:12:41