The set commands change the value of a user-declared variable to a string. The variable must have been declared using the declare command before its value can be set or consulted.
There are five forms of the set command:
set <variable> to <value> set <variable> by appending <value> set <variable> by replacing <value> with <value> set <variable> to the length of <value> set <variable> to characters <value> to <value> of <value>
Each <value> can be any of the following:
$blank, $space, $tab, $return
$dateStamp, $timeStamp
$lastEventEnder, $lastEventTime
$lastClick, $lastClickXCoord, $lastClickYCoord
$lastKey
$lastResponses
$cellValueA, $cellValueB, $cellValueC, …
$timerTime, $countdownTime
set variable to value
Replaces the existing value of the variable with a new value.
set $varCurrentScore to $slider
set $varGreetingText to Hello,
set $varB to $lastClick
set variable by appending value
Appends the new text to the end of the text currently in the variable.
set $varClickCellList by appending $lastClick
set $varA by appending $varN
set variable by replacing value with value
Replaces all occurences of the value from the contents of the variable.
set $varRemainingKeys by replacing $lastKey with X
set $varMoods by replacing angry with happy
set variable to the length of value
Finds the number of characters in the variable.
set $varNumberOfKeys to the length of $varKeysSoFar
set variable to characters begin to end of value
Replaces the existing value of the variable with some characters from a value. Character 1 is the first character. If the 'begin' number is less than 1 it is understood as 1. if the 'end' number is greater than the length of the source string, it is understood as the length of the source string. If the 'start' number is bigger than the 'end' value then the result is the a zero-length string.
set $varThirdChar to characters 3 to 3 of abcdefgh
set $varA to characters $varStart to $varEnd of 11100010
set $varB to characters 14 to 5 of doesn't matter what this is