Hey Omar,
oTIDs is a variable name and an abbreviation for Old-TIDS (E.g. old AppleScriptâs text item delimiters).
Yvan is using two lists to assign multiple variables at once, and heâs swapping their values.
set {var1, var2} to {"Some Text 1", "Some Text 2"}
log " The value of variable var1 is: '" & var1 & "' "
log " The value of variable var2 is: '" & var2 & "' "
See the Event Log History viewer in the Applescript Editor for the values of the items that are logged. The funky spacing in the log statements is so you can read them easier, and the single-quotes delimit the actual results.
The first script is functionally equivalent to this one:
set var1 to "Some Text 1"
set var2 to "Some Text 2"
log " The value of variable var1 is: '" & var1 & "' "
log " The value of variable var2 is: '" & var2 & "' "
In this case heâs following a good practice â that of using AppleScriptâs text item delimiters and then restoring them to their original value.
Text Item Delimiters define what characters delimit text.
Delimit == âdetermine the limits or boundaries ofâ
We tend to call them TIDs or ATIDs for brevity.
Theyâre very useful.
In the 3rd Edition of âLearn AppleScriptâ on pages 192-196 is a section that covers them.
The current Applescript Language Guide has them on p. 42.
You should read both.
You also need to become comfortable with variables and list objects.
Lots to learn.
Note that TextEdit is a pesky brat to script. (E.g. not very scriptable.
For something with teeth try Tex-Edit Plus. See what just a little code can do below.
tell application "Tex-Edit Plus"
tell front document's text
if (count of lines) ââ°ÂĽ 4 then
set _text to text of lines 1 thru 4 as text
set newDoc to make new document with properties {contents:_text}
tell newDoc
tell last line
set font to "Monoco"
set size to "18"
end tell
end tell
end if
end tell
end tell
AppleScript can be downright confusing to beginners, so itâs very important for you to spend time with the Applescript Language Guide and learn what the basic data types are and their syntax. Without that vocabulary itâs very hard to proceed.