Mac Tip #214/28-September-2005
For years now Macs have had the ability to automate tasks by using a feature called Applescript. Now, to be totally honest, my first hundred forays into Applescript were spectacularly unsuccessful and I found it very hard to grasp. Even more frustrating was that it seemed everyone else on the planet thought Applescript was totally straightforward and simple.
For the last few years though I have been making headway with it. I still think it’s not as easy as many claim, but it’s definitely worth investigating if there are things you do repeatedly with your Mac.
One thing I sometimes have to do is open a dozen folders and files for one or other of the projects I work on. This is a big pain; Applescript is perfect for the job.
Open the Applications folder, then the Applescript folder and then double click the Script Editor icon. A blank document will appear. This is where you can type your instructions.
You always need to “tell” something to do something. In this case I’m going to tell the Finder to open my Documents folder.
Type the following into the Script Editor, with one change: my username is ‘miraz’ — you need to replace that with your username.
Also, if you’ve changed your hard drive name from Macintosh HD then you’ll need to change that part too.
By the way, the speech marks and colons are important, and it needs to span three lines as typed below.
tell application "Finder" open "Macintosh HD:Users:miraz:Documents" end tell
Now go to the Script menu and choose Run (or type Command R or click the Run button on the Toolbar).
Your Applications folder should open. If you use OS 9 instead of Mac OS X then you may have to change the “path” — probably to: “Macintosh HD:Documents” — as I no longer have OS 9 I can’t double check that.
That script isn’t much, is it? But over a few more tips I’ll show you how to add more commands, meaning that eventually you’ll be able to click one button and have your computer do a whole lot of tasks for you.