Preface |
|
xxix | |
Acknowledgments |
|
xxx | |
Introduction |
|
xxxi | |
Quick Start: Dive into Automator and AppleScript |
|
1 | (1) |
|
Why Is Automation Important? |
|
|
2 | (1) |
|
|
3 | (1) |
|
|
4 | (13) |
|
|
6 | (2) |
|
|
8 | (1) |
|
Creating your first basic workflow |
|
|
9 | (5) |
|
Customizing your first workflow |
|
|
14 | (3) |
|
Options for saving your workflow |
|
|
17 | (1) |
|
|
17 | (11) |
|
|
28 | (1) |
|
Part I: The Fundamentals of Automation |
|
|
29 | (78) |
|
|
31 | (16) |
|
Why You Should Use Automation |
|
|
31 | (2) |
|
A Brief History of Automation |
|
|
33 | (3) |
|
Differences between mechanization and automation |
|
|
34 | (1) |
|
Negative connotations of automation |
|
|
35 | (1) |
|
Positive changes due to automation |
|
|
35 | (1) |
|
|
36 | (7) |
|
|
36 | (1) |
|
|
37 | (1) |
|
|
37 | (2) |
|
|
39 | (1) |
|
|
39 | (1) |
|
|
39 | (1) |
|
Launching applications and scripts |
|
|
40 | (1) |
|
|
41 | (1) |
|
|
42 | (1) |
|
Systems maintenance and backups |
|
|
43 | (1) |
|
|
43 | (3) |
|
|
43 | (1) |
|
|
44 | (1) |
|
|
45 | (1) |
|
|
45 | (1) |
|
|
46 | (1) |
|
|
46 | (1) |
|
|
46 | (1) |
|
Automation from a User's Perspective |
|
|
47 | (14) |
|
|
47 | (6) |
|
Typical activities to automate |
|
|
48 | (1) |
|
|
49 | (4) |
|
The Professional's Viewpoint |
|
|
53 | (3) |
|
The software developer's needs |
|
|
53 | (1) |
|
The system administrator's needs |
|
|
54 | (1) |
|
|
55 | (1) |
|
The Small Business Owner's Viewpoint |
|
|
56 | (4) |
|
What processes need automating? |
|
|
57 | (1) |
|
What files and data need automating? |
|
|
58 | (1) |
|
|
59 | (1) |
|
|
60 | (1) |
|
|
61 | (22) |
|
Opening Automator for the First Time |
|
|
61 | (1) |
|
|
62 | (8) |
|
|
63 | (1) |
|
|
63 | (2) |
|
|
65 | (2) |
|
|
67 | (3) |
|
|
70 | (1) |
|
What Kinds of Workflows Are Possible? |
|
|
71 | (3) |
|
|
74 | (2) |
|
What Else Can I Do with Actions? |
|
|
76 | (2) |
|
How Can Workflows Be Saved? |
|
|
78 | (3) |
|
|
78 | (1) |
|
|
79 | (1) |
|
|
80 | (1) |
|
|
81 | (1) |
|
|
82 | (1) |
|
Advanced Automator Topics |
|
|
83 | (24) |
|
|
84 | (10) |
|
|
84 | (2) |
|
|
86 | (1) |
|
|
87 | (1) |
|
|
88 | (1) |
|
|
88 | (1) |
|
|
89 | (2) |
|
|
91 | (1) |
|
|
91 | (2) |
|
Adding variables to workflows |
|
|
93 | (1) |
|
Using variables in a workflow |
|
|
93 | (1) |
|
|
94 | (4) |
|
|
94 | (1) |
|
|
95 | (3) |
|
|
98 | (4) |
|
|
98 | (1) |
|
|
99 | (2) |
|
|
101 | (1) |
|
|
102 | (4) |
|
First things first: Set up accessibility |
|
|
102 | (1) |
|
|
103 | (3) |
|
|
106 | (1) |
|
Part II: A Detailed Look at AppleScript |
|
|
107 | (162) |
|
|
109 | (16) |
|
|
109 | (1) |
|
A Brief History of AppleScript |
|
|
110 | (2) |
|
|
112 | (1) |
|
|
112 | (5) |
|
Starting AppleScript Editor |
|
|
113 | (1) |
|
The AppleScript Editor GUI |
|
|
113 | (1) |
|
|
114 | (1) |
|
Comments and error messages |
|
|
114 | (2) |
|
|
116 | (1) |
|
The AppleScript Editor Menus |
|
|
117 | (7) |
|
|
118 | (2) |
|
|
120 | (1) |
|
|
121 | (1) |
|
|
121 | (1) |
|
|
121 | (1) |
|
|
122 | (1) |
|
|
122 | (1) |
|
|
122 | (1) |
|
|
123 | (1) |
|
|
124 | (1) |
|
|
124 | (1) |
|
AppleScript Objects and Dictionaries |
|
|
125 | (18) |
|
|
125 | (8) |
|
AppleScript is an object-oriented language |
|
|
126 | (1) |
|
Everything you work with is an object |
|
|
127 | (2) |
|
Objects include properties and actions |
|
|
129 | (1) |
|
Even the script you're working with is an object |
|
|
130 | (1) |
|
A quick tour of script objects |
|
|
131 | (2) |
|
|
133 | (1) |
|
|
134 | (1) |
|
A Quick Tour of Dictionaries |
|
|
135 | (6) |
|
|
138 | (1) |
|
|
139 | (1) |
|
|
140 | (1) |
|
Looking Up an AppleScript |
|
|
141 | (1) |
|
|
142 | (1) |
|
Working with Variables and Properties |
|
|
143 | (16) |
|
|
143 | (10) |
|
|
144 | (2) |
|
Getting the value of a variable |
|
|
146 | (1) |
|
|
146 | (5) |
|
|
151 | (1) |
|
|
152 | (1) |
|
|
153 | (1) |
|
Creating Three Simple Scripts |
|
|
154 | (3) |
|
Script 1: Play random iTunes track |
|
|
154 | (1) |
|
Script 2: Copy files from one directory to another |
|
|
155 | (1) |
|
Script 3: View today's events in iCal |
|
|
156 | (1) |
|
|
157 | (2) |
|
Operators, Expressions, and Statements |
|
|
159 | (20) |
|
|
159 | (11) |
|
|
160 | (1) |
|
Logical conjunction (and) |
|
|
161 | (1) |
|
|
161 | (1) |
|
|
161 | (1) |
|
|
162 | (1) |
|
|
162 | (1) |
|
|
163 | (1) |
|
|
163 | (1) |
|
|
163 | (1) |
|
|
163 | (1) |
|
|
164 | (1) |
|
|
164 | (1) |
|
|
164 | (1) |
|
|
164 | (1) |
|
|
164 | (1) |
|
|
165 | (1) |
|
|
165 | (1) |
|
10 mod 3 -- results in 1Exponentiation (^) |
|
|
165 | (1) |
|
|
165 | (1) |
|
|
165 | (1) |
|
|
166 | (1) |
|
|
167 | (1) |
|
|
167 | (1) |
|
|
168 | (1) |
|
|
169 | (1) |
|
|
170 | (2) |
|
|
172 | (1) |
|
|
173 | (5) |
|
Script 1: Checking for e-mail validity |
|
|
173 | (2) |
|
Script 2: Inspect the Trash |
|
|
175 | (3) |
|
|
178 | (1) |
|
|
179 | (18) |
|
What Are Conditional Tests and Loops? |
|
|
179 | (1) |
|
|
180 | (5) |
|
|
180 | (1) |
|
|
181 | (1) |
|
|
182 | (3) |
|
|
185 | (8) |
|
|
185 | (1) |
|
Repeating a set number of times |
|
|
186 | (1) |
|
Repeating with defined start and stop values |
|
|
187 | (2) |
|
Repeating until something is true |
|
|
189 | (1) |
|
Repeating while something is true |
|
|
190 | (1) |
|
|
191 | (2) |
|
|
193 | (2) |
|
Script 1: Check if folder exists |
|
|
193 | (1) |
|
Script 2: Export e-mail addresses |
|
|
194 | (1) |
|
|
195 | (2) |
|
|
197 | (16) |
|
|
197 | (1) |
|
Sending a Message to the User |
|
|
198 | (5) |
|
|
198 | (1) |
|
|
199 | (1) |
|
The display dialog command |
|
|
200 | (3) |
|
|
203 | (1) |
|
|
204 | (2) |
|
Choosing Folders and Files |
|
|
206 | (2) |
|
|
208 | (2) |
|
|
210 | (1) |
|
|
211 | (2) |
|
|
213 | (14) |
|
|
213 | (2) |
|
|
215 | (1) |
|
|
216 | (2) |
|
Using Loops, Conditionals, and Variables in Subroutines |
|
|
218 | (1) |
|
|
218 | (1) |
|
|
219 | (2) |
|
|
221 | (5) |
|
Subroutine 1: Create a folder |
|
|
221 | (2) |
|
Subroutine 2: Move an item to the Trash |
|
|
223 | (2) |
|
Subroutine 3: Count items in a folder |
|
|
225 | (1) |
|
|
226 | (1) |
|
|
227 | (14) |
|
|
227 | (1) |
|
|
228 | (6) |
|
Open a Web page in Safari |
|
|
228 | (3) |
|
|
231 | (2) |
|
|
233 | (1) |
|
|
234 | (1) |
|
|
234 | (5) |
|
|
234 | (3) |
|
Set the desktop background |
|
|
237 | (2) |
|
|
239 | (2) |
|
|
241 | (14) |
|
|
241 | (1) |
|
|
242 | (2) |
|
|
244 | (2) |
|
Creating Your First Folder Action Script |
|
|
246 | (4) |
|
Creating Folder Action Plug-ins with Automator |
|
|
250 | (4) |
|
|
254 | (1) |
|
|
255 | (14) |
|
What Is AppleScript Studio? |
|
|
255 | (1) |
|
How Do You Access AppleScript Studio? |
|
|
256 | (2) |
|
What Can You Do with AppleScript Studio? |
|
|
258 | (1) |
|
|
259 | (1) |
|
Your First AppleScript Studio Project |
|
|
259 | (8) |
|
|
267 | (2) |
|
Part III: Automation Projects |
|
|
269 | (158) |
|
Ten Automation Projects for Files and Folders |
|
|
271 | (34) |
|
|
271 | (2) |
|
Creating a Basic Workflow to Process Specific Files |
|
|
273 | (3) |
|
|
273 | (2) |
|
|
275 | (1) |
|
|
275 | (1) |
|
Converting a Basic Workflow to Accept any Files |
|
|
276 | (4) |
|
|
276 | (1) |
|
|
277 | (1) |
|
|
277 | (3) |
|
Finding Files and Folders and Renaming Them |
|
|
280 | (4) |
|
|
280 | (2) |
|
|
282 | (2) |
|
Finding Files and Folders and Trashing Them |
|
|
284 | (2) |
|
|
284 | (1) |
|
|
285 | (1) |
|
|
286 | (1) |
|
Creating Aliases for Files and Folders |
|
|
286 | (3) |
|
|
287 | (1) |
|
|
288 | (1) |
|
|
288 | (1) |
|
|
289 | (4) |
|
|
289 | (1) |
|
|
290 | (1) |
|
|
291 | (2) |
|
|
293 | (1) |
|
|
293 | (1) |
|
|
294 | (1) |
|
|
294 | (3) |
|
|
294 | (1) |
|
|
295 | (1) |
|
|
296 | (1) |
|
Opening Files with the Proper Application |
|
|
297 | (2) |
|
|
297 | (1) |
|
|
297 | (1) |
|
|
298 | (1) |
|
Setting Spotlight Comments for Files and Folders |
|
|
299 | (4) |
|
|
299 | (2) |
|
|
301 | (1) |
|
|
302 | (1) |
|
|
303 | (2) |
|
Ten Automation Projects for Music and Audio Files |
|
|
305 | (30) |
|
|
305 | (1) |
|
Playing a Specific iTunes Song |
|
|
306 | (6) |
|
|
306 | (3) |
|
|
309 | (1) |
|
|
310 | (2) |
|
Adding Songs to a Playlist |
|
|
312 | (4) |
|
|
313 | (1) |
|
|
314 | (1) |
|
|
315 | (1) |
|
|
316 | (2) |
|
|
316 | (1) |
|
|
317 | (1) |
|
|
318 | (3) |
|
|
319 | (1) |
|
|
319 | (1) |
|
|
320 | (1) |
|
Pausing and Playing iTunes |
|
|
321 | (2) |
|
|
322 | (1) |
|
|
322 | (1) |
|
|
323 | (1) |
|
Setting Information on iTunes Songs |
|
|
323 | (4) |
|
|
323 | (1) |
|
|
324 | (3) |
|
|
327 | (1) |
|
Changing Case of Song Names |
|
|
328 | (2) |
|
|
328 | (1) |
|
|
329 | (1) |
|
Converting Text to Audio Files |
|
|
330 | (2) |
|
|
330 | (1) |
|
|
331 | (1) |
|
|
332 | (1) |
|
Adding Audio Files to an iPod |
|
|
332 | (2) |
|
|
333 | (1) |
|
|
333 | (1) |
|
|
333 | (1) |
|
|
334 | (1) |
|
Ten Automation Projects for Photos and Images |
|
|
335 | (36) |
|
|
335 | (1) |
|
Applying Color Changes to Groups of Images |
|
|
336 | (6) |
|
|
336 | (3) |
|
|
339 | (3) |
|
|
342 | (1) |
|
Cropping and Resizing Images |
|
|
342 | (7) |
|
|
342 | (2) |
|
|
344 | (3) |
|
|
347 | (2) |
|
|
349 | (3) |
|
|
349 | (1) |
|
|
350 | (2) |
|
|
352 | (2) |
|
|
352 | (1) |
|
|
352 | (1) |
|
|
353 | (1) |
|
Flipping and Rotating Images |
|
|
354 | (5) |
|
|
354 | (1) |
|
|
355 | (2) |
|
|
357 | (2) |
|
|
359 | (2) |
|
|
359 | (2) |
|
|
361 | (1) |
|
Importing Images to iPhoto |
|
|
361 | (3) |
|
|
361 | (1) |
|
|
362 | (2) |
|
Exporting Images from iPhoto |
|
|
364 | (1) |
|
Reviewing Photos in a PDF Contact Sheet |
|
|
365 | (3) |
|
|
366 | (1) |
|
|
367 | (1) |
|
Automating Taking Pictures with a Digital Camera |
|
|
368 | (1) |
|
|
368 | (1) |
|
|
369 | (1) |
|
|
369 | (2) |
|
Ten Automation Projects for Text Files |
|
|
371 | (28) |
|
|
371 | (2) |
|
|
373 | (3) |
|
|
373 | (2) |
|
|
375 | (1) |
|
|
375 | (1) |
|
Asking for Text from the User |
|
|
376 | (3) |
|
|
376 | (1) |
|
|
377 | (1) |
|
|
378 | (1) |
|
|
379 | (3) |
|
|
379 | (2) |
|
|
381 | (1) |
|
Getting a Specific Character |
|
|
382 | (1) |
|
|
382 | (1) |
|
|
383 | (1) |
|
Getting a Specific Paragraph |
|
|
383 | (4) |
|
|
383 | (1) |
|
|
384 | (3) |
|
|
387 | (3) |
|
|
387 | (1) |
|
|
388 | (1) |
|
|
389 | (1) |
|
Getting the Definition of a Word |
|
|
390 | (3) |
|
|
390 | (1) |
|
|
391 | (1) |
|
|
392 | (1) |
|
Using BBEdit: Working with Quotes |
|
|
393 | (2) |
|
|
394 | (1) |
|
|
395 | (1) |
|
Using BBEdit: Convert Spaces to Tabs |
|
|
395 | (1) |
|
|
395 | (1) |
|
|
396 | (1) |
|
Using BBEdit: Zapping Gremlins |
|
|
396 | (2) |
|
|
396 | (1) |
|
|
397 | (1) |
|
|
398 | (1) |
|
Ten Custom Automation Projects |
|
|
399 | (28) |
|
|
399 | (1) |
|
Finding Specific Contacts in Address Book |
|
|
400 | (3) |
|
|
400 | (1) |
|
|
401 | (1) |
|
|
402 | (1) |
|
Finding People with Birthdays |
|
|
403 | (3) |
|
|
403 | (1) |
|
|
404 | (2) |
|
|
406 | (3) |
|
|
406 | (1) |
|
|
406 | (3) |
|
Finding Specific Calendar Items |
|
|
409 | (1) |
|
|
409 | (1) |
|
|
410 | (1) |
|
|
410 | (1) |
|
Getting New Mail Messages |
|
|
410 | (3) |
|
|
410 | (1) |
|
|
411 | (1) |
|
|
412 | (1) |
|
|
413 | (3) |
|
|
413 | (2) |
|
|
415 | (1) |
|
Adding Attachments to Messages |
|
|
416 | (3) |
|
Extracting Text from PDFs |
|
|
419 | (3) |
|
|
419 | (2) |
|
|
421 | (1) |
|
|
422 | (1) |
|
Downloading Specific URLs |
|
|
423 | (2) |
|
|
425 | (2) |
|
|
427 | (85) |
|
Appendix A: Automator Resources |
|
|
429 | (10) |
|
|
429 | (1) |
|
VTC Mac OS X Automator tutorials |
|
|
429 | (1) |
|
|
430 | (2) |
|
|
432 | (1) |
|
|
432 | (2) |
|
Automator-dev mailing list |
|
|
434 | (1) |
|
|
434 | (1) |
|
|
434 | (1) |
|
|
435 | (1) |
|
|
436 | (1) |
|
|
437 | (1) |
|
|
437 | (1) |
|
|
438 | (1) |
|
|
438 | (1) |
|
Appendix B: AppleScript Resources |
|
|
439 | (12) |
|
|
439 | (1) |
|
MacResearch AppleScript tutorials |
|
|
439 | (2) |
|
|
441 | (1) |
|
|
442 | (2) |
|
Video tutorials on the Web |
|
|
444 | (1) |
|
|
445 | (1) |
|
|
445 | (1) |
|
|
446 | (1) |
|
Doug's AppleScripts for iTunes |
|
|
446 | (1) |
|
AppleScript downloads on CNET |
|
|
447 | (1) |
|
|
448 | (1) |
|
|
449 | (2) |
|
Appendix C: AppleScript Reference |
|
|
451 | (34) |
|
|
452 | (1) |
|
|
452 | (1) |
|
|
452 | (1) |
|
|
453 | (1) |
|
|
453 | (1) |
|
|
453 | (1) |
|
|
453 | (1) |
|
|
454 | (1) |
|
|
454 | (1) |
|
|
454 | (1) |
|
|
454 | (1) |
|
|
454 | (1) |
|
|
454 | (1) |
|
|
455 | (1) |
|
|
455 | (1) |
|
|
455 | (1) |
|
|
456 | (1) |
|
|
456 | (1) |
|
|
456 | (1) |
|
|
456 | (1) |
|
|
456 | (1) |
|
|
456 | (1) |
|
|
456 | (1) |
|
|
456 | (1) |
|
|
457 | (1) |
|
|
457 | (1) |
|
|
457 | (1) |
|
|
457 | (1) |
|
|
458 | (1) |
|
|
458 | (1) |
|
|
458 | (1) |
|
|
458 | (1) |
|
|
459 | (1) |
|
|
459 | (1) |
|
|
459 | (1) |
|
|
459 | (1) |
|
|
459 | (1) |
|
|
459 | (1) |
|
|
459 | (1) |
|
|
460 | (1) |
|
|
460 | (1) |
|
|
460 | (1) |
|
|
461 | (1) |
|
|
461 | (1) |
|
|
461 | (1) |
|
|
461 | (1) |
|
|
461 | (1) |
|
|
461 | (1) |
|
|
461 | (1) |
|
|
461 | (1) |
|
|
462 | (1) |
|
|
462 | (1) |
|
|
463 | (1) |
|
|
463 | (1) |
|
|
463 | (1) |
|
|
463 | (1) |
|
|
464 | (1) |
|
|
464 | (1) |
|
|
465 | (1) |
|
|
465 | (1) |
|
|
465 | (1) |
|
|
465 | (1) |
|
|
465 | (1) |
|
|
465 | (1) |
|
|
465 | (1) |
|
|
465 | (1) |
|
|
466 | (1) |
|
|
466 | (1) |
|
|
466 | (1) |
|
|
466 | (3) |
|
|
469 | (1) |
|
|
470 | (1) |
|
Logical conjunction (and) |
|
|
470 | (1) |
|
|
470 | (1) |
|
|
470 | (1) |
|
|
470 | (1) |
|
|
470 | (1) |
|
|
471 | (1) |
|
|
471 | (1) |
|
|
471 | (1) |
|
|
471 | (1) |
|
|
472 | (1) |
|
|
472 | (1) |
|
|
472 | (1) |
|
|
472 | (1) |
|
|
472 | (1) |
|
|
472 | (1) |
|
|
472 | (1) |
|
|
473 | (1) |
|
|
473 | (1) |
|
|
473 | (1) |
|
|
473 | (1) |
|
Control Statements Reference |
|
|
474 | (1) |
|
|
474 | (1) |
|
|
474 | (1) |
|
|
475 | (2) |
|
|
477 | (1) |
|
|
478 | (1) |
|
|
478 | (2) |
|
AppleScript Reserved Keywords |
|
|
480 | (3) |
|
AppleScript Error Numbers |
|
|
483 | (1) |
|
|
484 | (1) |
|
Appendix D: Automator Actions and Variables |
|
|
485 | (27) |
|
|
485 | (1) |
|
|
486 | (1) |
|
|
487 | (1) |
|
|
488 | (2) |
|
|
490 | (2) |
|
|
492 | (2) |
|
|
494 | (1) |
|
|
495 | (2) |
|
|
497 | (2) |
|
|
499 | (2) |
|
|
501 | (2) |
|
|
503 | (2) |
|
|
505 | (1) |
|
|
506 | (1) |
|
|
507 | (1) |
|
|
507 | (1) |
|
|
508 | (1) |
|
|
509 | (1) |
|
|
510 | (1) |
|
|
511 | (1) |
|
|
511 | (1) |
|
|
512 | |