HomeTipsArticles

 
 

Continued from page 1

AppleScript Basics
by Maria Langer

AppleScript Dictionaries
Scriptable applications include AppleScript dictionaries, which list and provide syntax information for valid AppleScript commands and classes. These dictionaries are a valuable reference for anyone who wants to write scripts.

An AppleScript dictionary is organized into suites. Each suite includes a number of related commands and classes. Commands are like verbs--they tell an application to do something. Classes are types of objects that a command can be performed on. For example, in TextEdit's Standard Suite, close is a command that can be performed on an object such as window.

Figures 93 and 94 (Below) show examples of AppleScript Dictionaries for two applications: Finder and TextEdit. In each illustration, the first suite is selected to display all commands and classes in that suite. On the left side of the window, suite names appear in bold text, commands appear in normal text, and classes appear in italic text.



Tip
Although dictionaries are helpful for learning valid AppleScript commands, they are not sufficient for teaching a beginner how to write scripts.

Script Menu
Script Menu is a utility that enables you to access AppleScripts from the Finder's menu bar. When installed, it adds a script menu full of example scripts to the menu bar. You can modify this menu by removing scripts you don't use or adding your own custom scripts.

Folder Actions
Folder Actions is a feature of Mac OS X that works with AppleScript. You create a script that performs a specific task, then attach that script to a folder. When the folder is modified in a predefined way--for example, when it is opened or a file is added to it--the script activates and performs its task.

How can Folder Actions help you? Here's an example. Suppose you're writing a book and every time you finish a chapter, you need to upload a copy of it to an FTP site so your editors can download and review it. You can write a script that uploads any new file added to a folder to the FTP site. Attach that script to a folder and voila! Every time you save a copy of a chapter to the folder, it is automatically sent for review.

Tip
To learn more about writing scripts for Folder Actions, visit www.apple.com/applescript/folder_actions/.

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

More...

Featured Article
More Articles



MacTipsandTrick
Web


Search for other computer books at Amazon.com