AppleScript: The Definitive GuideIf you want to know all about AppleScript--the how, where, and why of using it--dig into AppleScript: The Definitive Guide. It doesn't make the mistake that other books do: it isn't about scripting this or that particular application, and it doesn't assume that learning AppleScript is easy or obvious. Instead, the book teaches and documents the language in a clear and rigorous manner, just as you'd expect with any programming or scripting language. AppleScript is a dynamic, object-oriented scripting system that allows Mac users--even novices who know nothing about programming--to directly control Macintosh applications, including the Mac OS itself. You can write scripts to automate repetitive tasks, customize applications, and even control complex workflows. AppleScript has always been useful, but with Mac OS X it's even more so. Nearly every application that comes with Mac OS X is scriptable. Even non-scriptable applications can often be driven with AppleScript, thanks to the new Accessibility API and GUI Scripting technologies. And now AppleScripters can put a true Aqua interface around their scripts! There's never been a more exciting time for AppleScript users. AppleScript: The Definitive Guide explores and teaches the language from the ground up. If you're a beginner and want to learn how to write your first script or just understand what the excitement is all about, you'll be able to do so after reading this book. AppleScript: The Definitive Guide is the quintessential guide to this important Mac tool. Regardless of their level of experience, AppleScripters everywhere will turn to this book again and again. |
Contents
Ways to Use AppleScript | 3 |
Is This Application Scriptable? | 5 |
Calculation and Repetition | 6 |
Reduction | 8 |
Customization | 10 |
Places to Use AppleScript | 16 |
Script Editor | 17 |
Scripting Environment | 22 |
Identifying References | 210 |
Dereferencing a Reference | 211 |
Creating References to Local Variables | 215 |
Control | 218 |
Looping | 220 |
Tell | 228 |
Using Terms From | 229 |
With | 232 |
Internally Scriptable Application | 23 |
Script Runner | 28 |
Automatic Location | 29 |
Application | 31 |
Unix | 37 |
The AppleScript Experience | 39 |
A Day in the Life | 41 |
Conclusions Lessons and Advice | 62 |
Basic Concepts | 65 |
The Open Scripting Architecture | 73 |
Script | 77 |
Compiling and Decompiling | 80 |
Script Text File | 86 |
Applet and Droplet | 88 |
Scripting Addition | 89 |
Dictionary | 90 |
Scriptable Recordable Attachable | 92 |
The AppleScript Language | 95 |
Introducing AppleScript | 97 |
Extensibility and Its Perils | 98 |
The Englishlikeness Monster | 99 |
Objectlikeness | 101 |
LISPlikeness | 102 |
The Learning Curve | 103 |
Syntactic Ground of Being | 104 |
Result | 106 |
Comments | 109 |
Abbreviations and Synonyms | 110 |
Blocks | 111 |
The | 112 |
Variables | 113 |
Declaration and Definition of Variables | 115 |
Variable Names | 117 |
Scoping of Variables | 120 |
Script Properties | 131 |
Lifetime of Variables | 137 |
Handlers | 140 |
Returned Value | 141 |
Parameters | 143 |
Syntax of Defining and Calling a Handler | 145 |
Pass By Reference | 148 |
Scoping of Handlers | 150 |
Handlers as Values | 155 |
Script Objects | 159 |
Scoping of Script Objects | 160 |
TopLevel Entities | 162 |
Script Objects Run Handler | 164 |
Script Objects as Values | 166 |
Compiled Script Files as Script Objects | 172 |
Inheritance | 178 |
Objects | 184 |
Class | 185 |
Get | 191 |
It | 192 |
Me | 194 |
Properties and Elements | 195 |
Element Specifiers | 197 |
Properties of Multiple References | 204 |
Object String Specifier | 205 |
References | 206 |
References as Incantations | 207 |
Creating a Reference | 209 |
ConsideringIgnoring | 234 |
Errors | 236 |
SecondLevel Evaluation | 242 |
Datatypes | 243 |
Integer Real and Number | 244 |
Date | 245 |
String | 247 |
Unicode Text | 249 |
Styled Text | 251 |
Alias | 253 |
Application | 255 |
Data | 256 |
Record | 261 |
Coercions | 264 |
Explicit Coercion | 265 |
Boolean Coercions | 267 |
String Number and Date Coercions | 268 |
List Coercions | 269 |
Unit Conversions | 270 |
Operators | 272 |
Boolean Operators | 274 |
Comparison Operators | 275 |
Containment Operators | 277 |
Concatenation Operator | 279 |
Parentheses | 281 |
Who Performs an Operation | 282 |
Global Properties | 285 |
Strings | 286 |
Numbers | 287 |
Miscellaneous | 288 |
Constants | 289 |
Commands | 292 |
Logging Commands | 293 |
AppleScript In Action | 295 |
Dictionaries | 297 |
Resolution of Terminology | 298 |
Resolution Difficulties | 301 |
Whats in a Dictionary | 309 |
The aeut Resource | 320 |
Inadequacies of the Dictionary | 321 |
Scripting Additions | 332 |
Scripting Additions and Speed | 333 |
Classic Scripting Additions | 334 |
Loading Scripting Additions | 335 |
Standard Scripting Addition Commands | 336 |
Scriptable Applications | 349 |
Some Scriptable Applications | 353 |
Unscriptable Applications | 356 |
Getting Started with Accessibility | 357 |
GUI Scripting Examples | 358 |
Unix | 362 |
Osascript | 365 |
Writing Applications | 370 |
Digital Hub Scripting | 377 |
CGI Application | 379 |
AppleScript Studio | 382 |
Appendixes | 403 |
The aeut Resource | 405 |
Tools and Resources | 424 |
431 | |