Applescript 102

Applescript 102 Mac Tip #215/05-October-2005

In the last Tip I introduced you to making an Applescript, in order to save time and effort. First you’ll want to save the script somewhere. I have a folder named Scripts in my Documents folder to keep all my Applescripts together.

Choose Save from the File menu and save the script somewhere in the script format. Once saved, you can easily run it — sometimes using other utilities so you can trigger a script of dozens or hundreds of actions with one keystroke.

Now, let’s add some more actions, to make this script truly worthwhile. Add extra commands by putting each one on a new line before the final end tell. The following commands would:

open a document called TimeSheet.oo3, which is in the clients2005 folder inside my Documents folder. Just repeat the command with the name and path of each document to open.

open the web pages for Google News (NZ) and MacTips.Info

open the Dictionary and Mars Edit applications

Here is our new script:

tell application "Finder"
open "Macintosh HD:Users:miraz:Documents"
open "Macintosh HD:Users:miraz:Documents:clients2005:TimeSheet.oo3"
open location "http://news.google.co.nz"
open location "http://mactips.info"
open "Macintosh HD:Applications:Dictionary.app"
open "Macintosh HD:Applications:MarsEdit.app"
end tell