Variables
A variable stores a value so that you can use it in expressions. You use variables, rather than literal values, for several reasons: To designate a variable, you use a name. Variable names can be anything you want. They are not case-sensitive, so "theName" is the same as "thename." To create a variable, you assign it a value: set theWord to "Mark" In the example, "theWord" is the variable. After the command is executed, the variable contains the value "Mark." You can also use an expression to assign a value to a variable: set theWord to word 1 of text body of document "Simple" To use a variable, include its name in a command or another expression. display dialog theWord AppleScript defined variables AppleScript defines two special variables:
|
||||||||||||
Table of contents |