I have a number of scripts where I need to associate two sets of data. The following is a simple search-and-replace example that uses two lists:
display dialog "Enter a string:" default answer "test,test,dx"
set myString to text returned of result
set shortcutCharacters to {",", "dx", "mx"}
set replacementString to {" - ", "04.08.19", "April 2019"}
repeat with i from 1 to (count shortcutCharacters)
set AppleScript's text item delimiters to item i of shortcutCharacters
set myString to every text item of myString
set AppleScript's text item delimiters to item i of replacementString
set myString to myString as text
end repeat
In the place of two lists, it seems like this might better be done using a record. However, after playing around with this for a while, and doing some google research, I concluded that a record can’t be used for this purpose. Just to be sure, and because my knowledge of records is extremely limited, I thought I might raise the issue in this forum.
BTW, these are scripts that I use daily and I have to be able to manage them. So, at least for now, I’m pretty much limited to regular AppleScript.
Thanks.