![]() |
The Script EditorYou'll find the Script Editor in the AppleScript folder within the Apple Extras folder of a normal Mac OS installation. Open it up, and you'll see a window that looks like this:
This is the place where you'll spend most of your time editing your scripts, so you'll probably want to know what everything does. The collapsible description field allows you to write a text description of your script that gets included when the script file is saved; this can be good if you're sharing your script with others. The main text field below the row of buttons is where you type your script. The Run and Stop buttons are self-explanatory; they control the execution of your script. Record allows you automatically generate scripts--press record, perform some actions in another application, then come back and press Stop, and you get a script. The Check Syntax button runs your script through AppleScript's compiler and reports any syntax errors. After a script has been checked and found to be error-free, the text is reformatted according to AppleScript's text formatting rules. This indicates that the script has been compiled into the bytecode form used by the AppleScript runtime interpreter. One nice thing about this is that it allows for language independence; once a script has been compiled, it can be translated into a number of languages at the press of a button. However, compiled scripts also lose a bit of portability, as they can contain parts which are specific to your machine's OS version and installed applications. It's generally a good idea to change your AppleScript formatting settings so that you can tell the difference between all the keyword types used; just like syntax coloring in other programming editors, it can make debugging easier. The AppleScript Formatting window can be pulled up from the Edit menu; select a keyword type and use the Font and Style menus to customize it to your choosing. You can also select your AppleScript Dialect (the human language that compiled text is displayed in) here. We'll be using these settings for the duration of the workshop series:
|
Previous: About This Workshop |
Next: Values & Variables |