Values and constants
A value is data used by a script. A value might be a number, the name of an object, or the setting of a property. AppleScript only recognizes certain types of data such as text, integers, lists, and dates.
Each value has a class, which determines its properties, elements, operations, and the literal expressions or constants that can be used with it. Here are some of the types of values you can use:
|
Boolean: either true or false |
|
Class: a class name |
|
Constant: a word defined by AppleScript or a program |
|
Data: data returned by a program that doesn't belong to any other type of value |
|
Date: a complete date includes the day of the week, the month, day of month, year, and time |
|
Integer: a positive or negative number: 1, 2, 3 |
|
List: a list of values |
|
{"it's", 2, true} |
|
Each item in the list can belong to any class. |
|
Number: a synonym for Integer and Real |
|
Real: a positive or negative number that can include a decimal fraction |
|
Record: an unordered collection of properties |
|
{name: "Steve", height: 74.5, weight: 175} |
|
Reference: a reference to an object |
|
String, International Text, Styled Text, Text: types of text values |
AppleScript constants
AppleScript defines a large number of constants that you can use to make your scripts easier to understand. Here are some of the common ones you'll want to use:
|
|
|
|
|
|
|
Type |
|
Values |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Boolean |
|
true, false |
|
|
|
Date |
|
minutes, hours, days, weeks |
|
|
|
|
the days of the week |
|
|
|
|
the months of the year |
|
|
|
Save options |
|
yes, no, ask |
|
|
|
String |
|
return, space, tab |
|
|
|
Text style |
|
all caps, all lowercase, bold, condensed, expanded, hidden, italic, outline, plain, shadow, small caps, strikethrough, subscript, superscript, underline |
|
|
|