beautypg.com

What is finder scripting? 1 – Apple AppleScript Finder Guide User Manual

Page 14

background image

C H A P T E R 1

Introduction to Finder Scripting

2

What Is Finder Scripting?

IMPORTANT

Finder scripts that return a lot of information may need as

much as several hundred kilobytes (K) of free memory to

work correctly. To see how much memory is currently free,

activate the Finder, choose About This Macintosh from the

Apple menu, and check the number labeled Largest

Unused Block in the About This Macintosh window. If a

script you’ve used successfully stops working, try quitting

one or more applications to make more memory

available.

What Is Finder Scripting?

1

The Finder is a specialized application that controls the Macintosh desktop: the

working area of your screen where you can use the mouse and the keyboard to

open and close folders, manipulate files, and inspect or alter various aspects of

the computer’s operation. Finder scripting involves performing the same kinds

of tasks, except that instead of triggering actions with the aid of the mouse and

the keyboard, you trigger actions from scripts.
The Finder is both scriptable and recordable. A scriptable application is one that

can respond to commands sent to it when another application, such as the Script

Editor, runs a script. A recordable application is one that uses Apple events to

report user actions for recording purposes. When recording is turned on, the

Script Editor creates statements corresponding to any significant actions you

perform in recordable applications, including actions you perform in the Finder.

By recording or writing scripts that control the Finder, you can automate many

file management and networking tasks that you would otherwise have to

perform manually.
For example, the script that follows copies the items from a folder on the

startup disk to a folder on a different disk. Instead of opening all the folders

by double-clicking them then dragging the contents of the AppleScript

folder to a storage disk, you can run the script.