4.1. String NotationIn AppleScript, pieces of text are stored in a format called strings. A string can contain as many letters, numbers, spaces, and punctuation marks as you'd like. In AppleScript, strings are typically placed between double quotes, like so: "Yam farmer" "5504.45" "What the *#@&?!" However, you won't get much use out of strings unless you can store them for later userather than having to constantly recreate them. To store a string, you use the set command, like this: set welcomeMessage to "Take your shoes off before entering the building." In the previous example, welcomeMessage is a variable: a name given to a stored value (Sidebar 4.1). Variables come in handy when you have a long string you want to recall later. Rather than having to type in all that text each and every time you want to use it, you just substitute the variable name anywhere you want the string to appear, like this: set welcomeMessage to "Take your shoes off before entering the building."
display dialog welcomeMessage In the previous example, AppleScript notices the welcomeMessage variable that follows the display dialog command, and substitutes in the value that you set on the previous line. That's why running the previous script would display a dialog box that says "Take your shoes off before entering the building."
![]() |