HomeTipsArticles

 
 

Continued from page 3

AppleScript Basics
by Maria Langer

To record a script

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

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

  3. Click the Record button.

  4. Perform the steps you want Script Editor to record. As you work, Script Editor writes AppleScript instructions in the Script Editor window.



  5. When you are finished recording steps, switch to the Script Editor window and click the Stop button. Script Editor writes the last instruction for the script.



Tips
Unfortunately, Script Editor's recorder does not work with all applications. If you attempt to record a task and Script Editor does not write any instructions, the appli-cation you are using is not recordable.

Before you record a script, it's a good idea to know exactly what you want to do. This will prevent errors--which will also be recorded by Script Editor's recorder!

Once you have a script recorded by Script Editor, you can edit it as necessary to customize it.


To save a script

  1. Choose File > Save to display the Save Location dialog.



  2. Enter a script name in the Save As box.

  3. Choose a file format from the File Format pop-up menu.



  4. Use the Where part of the dialog to select a location in which to save the file.

  5. Click Save. The file is saved on disk. The script name appears in the title bar of the Script Editor window.

Tips
You cannot save a script if it will not compile. Check the script syntax before attempting to save the file; I explain how earlier in this section.

If you're not sure what to choose in step 3, choose Script.

It's a good idea to save a script before trying to run it for the first time.

To run a script
Do one of the following:

  • To run a compiled script from within Script Editor, click the Run button in the Script Editor window.

  • To run an application from the Finder, double-click the icon for the applet.

If the script is valid, it performs all script commands.

or

If the script is not valid, an error message appears. Click OK.



To open an application's AppleScript dictionary

  1. Choose File > Open Dictionary

  2. In the Open Dictionary dialog that appears, select a dictionary and click Open. The dictionary opens in its own window.



  3. Click the name of a suite, command, or class to display its information in the right side of the window.

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