Constants and Predefined Variables

Constants are reserved words that AppleScript has given a predefined value that you cannot change. There are boolean constants (true or false), date constants (e.g., April, May), and considering or ignoring constants (e.g., case, white space), among others. Predefined variables, on the other hand, have a changeable value. In other words, you can use code such as set pi to 5 and the pi predefined variable will no longer have the value of about 3.14159 in your script! You cannot change the value of the boolean constant false, however (set false to 3 will not compile). The constants are listed in Table 6-1, and the Predefined Variables are listed in Table 6-2. Certain date and time values (i.e., minutes, hours, days, weeks) are changeable in a script like predefined values; however, they are grouped with other date constants for convenience.

Table 6-1. AppleScript Constants

all caps

all lowercase

application responses

ask

bold

case

condensed

current application

date and time constants (e.g., January, February)

diacriticals

expanded

expansion

false

hidden

hyphens

italic

no

outline

plain

punctuation

shadow

small caps

strikethrough

subscript

superscript

true

underline

white space

yes

 
Table 6-2. AppleScript Predefined Variables
anything
it
me
missing value
pi
result
return
space
tab
version
my

Get AppleScript in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.