What’s So Great about AppleScript?
If one word could describe what AppleScript is all about, it’d be automation. AppleScript is a technology for automating practically any action you perform with your Macintosh, including both common tasks in Finder and those you perform in other applications.
Automate common tasks in Finder
If you’ve ever found yourself repeating some task, you’re an ideal candidate for becoming an AppleScript techno-wizard. AppleScript is particularly good at taking the boredom and tedium out of using your Macintosh by performing all sorts of tasks automatically. To illustrate, consider a few jobs that would take a fair amount of time to do by hand but are a snap with AppleScript:
While writing your next best-selling Great American Novel — or For Dummies book on OS X — you make a mistake and misnumber the chapters. All the chapters have a filename bearing the chapter number, but they’re all off by one. Sure, you could rename each file by hand, but your book is a large tome and renumbering dozens of chapters manually doesn’t sound like much fun.
It’ll require several minutes and lots of tedious attention on your part, not to mention introduce the likelihood of human error. But wait, there’s another way! When using a simple AppleScript of only a few lines of code, you can rename the chapters in seconds whilst you go grab another Diet Coke.
You’re a neat individual and think that your Mac should reflect your penchant for order — you like your Desktop icons to be placed just so. Being left-handed, you prefer the icons over on the left side of the Desktop, like that other operating system.
In this situation, an AppleScript can help you do things that aren’t humanly possible; not only can you rapidly rearrange the icons on your Desktop, but you can do so with pixel-point accuracy. Without AppleScript, it’d be nearly impossible to precisely align a dozen icons. And even if you could, it would take a long time.
After a font-download binge, you find yourself with hundreds of fonts. You really want to organize them into separate folders based on the date that you downloaded them.
AppleScript comes to the rescue again! With a brief script, you could knock out this challenge without ever looking at a single date. Add a couple more lines of code to the script, and AppleScript takes care of creating the folders, too. Right, you know the word: sassy.
Automate tasks in other applications
By using AppleScript, you can also often automate your work from beginning to end, despite the fact that you need multiple applications to do so. Look at a few scenarios, and you’ll begin to appreciate why AppleScript is such a powerful technology:
You just completed creating the ultimate library of bagpipe songs in iTunes — no, really! — and you want to share the list with your friends at the next Bagpipers Anonymous meeting. You could easily send everyone in the group an iTunes Playlist, but not everyone in the club has iTunes installed, let alone a computer.
This is going to require creating a hard copy for those members without a computer. Because your bagpipe song list contains thousands of songs, you don’t want to retype the name of each song. AppleScript can save the day by extracting the song titles for you and compiling them into a list just in time for your meeting.
AppleScript can take care of your computer-owning bagpipe friends, too. With a few extra steps, you can email all of them the list as well.
Being so doggone fond of bagpipes, you want to send your bagpiping friends a special note during the holidays. To help manage your holiday greeting cards, you can create a record in Contacts, FileMaker Pro, or some other database listing the name and address of each person who should receive a card.
If you’ve entered their street addresses in the Contacts section of your email application, AppleScript can aid in transferring the addresses from your email application to the database. Never again will your bagpiping friends miss a holiday greeting . . . and the world is a much better place.
As you can imagine, you can use AppleScript to automate your workflow in thousands of ways. (A workflow is a single sequence or project that one or more people work on using multiple applications. In other words, your document can be automatically manipulated in multiple applications using the same script.)