Hardware Reference
In-Depth Information
Either way, if something isn't working the way you expect, the first thing you should ask
yourself is whether you're telling the right entity to do something.
GUI Scripting
Sometimes you need an AppleScript to do something that an app provides no direct
access to in an AppleScript dictionary. You may be able to work around this with GUI
scripting, which instructs AppleScript to simulate mouse clicks, button presses, menu
commands, and the like—”playing” the user interface. It's not foolproof, but it can
solve otherwise intractable problems. For details, read the page Graphic User Interface
(GUI) Scripting , at Mac OS X Automation.
Use AppleScript Folder Actions
A folder action is an AppleScript that runs automatically when something happens to a
specified folder—for example, you open or close it, or add files to it. In my book Take Control
of Your Paperless Office , I described a situation in which your scanner saves PDF files to a
certain folder—but what you want is for your OCR software to open the PDFs, recognize the
text in them, save them as searchable PDFs, and then close them. No problem: attach one
of my spiffy folder action scripts to the folder where your scans are saved, and all that can
happen automatically.
Not just any old AppleScript can be a folder action; it must be written specially for that
purpose. (For details, see the Folder Actions Reference page on Apple's Developer site.)
In addition, before you can use folder action scripts, you must enable the system-wide Folder
Actions capability if you haven't previously done so, and attach a particular script to the
folder where your incoming scans are stored:
1. Make sure whatever script you want to use is stored in the /Library/
Scripts/Folder Action Scripts folder or in ~/Library/Scripts/
Folder Action Scripts .
2. Right-click (Control-click) the folder you want to attach the script to, and from
the contextual menu that appears, choose Folder Actions Setup (if youdon't see
itatthetoplevelofthecontextualmenu,lookontheServicessubmenu).Folder
Actions Setup opens.
3. In the dialog that appears, select the script you want to use. (Although you can
attach multiple AppleScripts to a single folder, I don't recommend it. Pick a
single script, and if need be, you can return to this dialog and change it later.)
Search WWH ::




Custom Search