HomeTipsArticles

 
 

Continued from page 2

AppleScript Basics
by Maria Langer

Using AppleScript
As with most programming languages, AppleScript can be extremely complex--far too complex to fully cover in this book. On the following pages, I explain how you can get started using AppleScript. This introduc-tion should be enough to help you decide whether you want to fully explore the world of AppleScript programming.

To launch Script Editor
Open the Script Editor icon in the Apple-Script folder in your Applications folder. An untitled Script Editor window appears.

or

Open the icon for a script. The script appears in a Script Editor window.

To write a script

  1. If necessary, choose File > New to open an empty Script Editor window.

  2. If desired, type a description for the script in the bottom half of the window.

  3. Type the script steps in the top half of the window. Be sure to press RETURN after each line.

To check the syntax for a script
Click the Compile button in the script window.

If your script's syntax is error-free, Script Editor formats and color-codes your state-ments.

or

If Script Editor finds a problem with your script, it displays a dialog that describes the problem and indicates where it is in the script by selecting it. Click OK to dismiss the dialog and fix the problem.

If the script contains an error, you’ll see a dialog
sheet like this one when you attempt to compile it.

Script Editor helps you debug a script by highlighting problems.

Tips
The syntax checker uses AppleScript's compiler to translates the script into code that can be read and understood by your computer. (Compiled code does not appear on screen.) If the script cannot be compiled, a syntax error results.

Unfortunately, even if you write a script without any syntax errors, the script is not guaranteed to work. The only way to make sure a script works is to run it.

MAC OS X 10.3 PANTHER ED: VISL QUICKSTRT GD, © 2004 Maria Langer Reproduced by permission of Pearson Education, Inc. Publishing as Peachpit Press. ALL RIGHTS RESERVED. To buy this book, visit www.peachpit.com

 


Today's Tip
Recent Tips

Troubleshooting External Devices

Schedule Scripts and Apps with iCal

iTunes - Classic Visualizer Configurations

More...

Featured Article
More Articles



MacTipsandTrick
Web


Search for other computer books at Amazon.com