Skip to Content

AppleScript: build a simple task launcher

If you're like me, when you sit down at your Mac, you end up opening a few specific apps depending on what kind of project you're working on. I am going to show you how you can group these applications into "task launchers" that will bring up a suite of programs with one click. For instance, I have a script that will open iPhoto, iDVD, and iMovie called "Create Movies." When I run this script, it will open all of the applications I need to make my movie. I also have one called "Productivity" that will, when opened, launch Mail, iChat, Pages, and Yojimbo (even though some might argue with iChat's productivity value).

Want to make your own launchers? Continue reading for the instructions.

Writing the Script

To create this script, you will use the tell command -- you may recall that this tells a specific application to do a specific task. Open the Script Editor and type the following script:

tell application "X" to activate

Replace the "X" with your application of choice. For example, if you wanted to add Mac OS X's Mail application, you would type:

tell application "Mail" to activate

Remember to include the quote marks around the application name (this helps to prevent errors for some applications). You can repeat this tell command for as many applications as you would like to open. When you're done, your AppleScript should look something like this:


Saving Your AppleScript
Once you have your script typed, let's save it. We'll save this application as an application bundle (as noted in the post on how to save AppleScripts, application bundles will allow you to save a universal application; in other words, it will work on both Intel and PowerPC Macs).

Go to the save dialog (File > Save). Once there, let's tweak some save settings. In the "File Format" drop-down menu, select "Application bundle." You can also check the "Run Only" checkbox (if you don't want people to see your script after it is saved).


Using the task launcher
You can repeat the steps above to create as many of these task launchers as you would like. To activate the script, just double click on its icon. If you want to streamline a bit further, you can place these scripts in the dock, either among the applications or in a folder so you can make a stack out of them.

To create a stack, just make a new folder in a convenient location (perhaps a "Launchers" folder in your home directory), drag-and-drop the scripts that you've created into your new folder; then drag the entire folder to the right side of the divider in the dock. You now can have multiple applications launch with just two clicks!



There you have it, your very own "no-duct-tape-required" task launchers!


If you're like me, when you sit down at your Mac, you end up opening a few specific apps depending on what kind of project you're working...
 

Add a Comment

*0 / 3000 Character Maximum

25 Comments

Filter by:
Vince

Is there a way i can have apps run in different spaces?

February 26 2008 at 4:18 AM Report abuse rate up rate down Reply
Le Son

If you have Growl, you can also use it to make notifications after programs have launched, I did that :D

Just use:

tell application "GrowlHelperApp"
register as application...

notify...
end tell

You may also head over to http://growl.info/documentation/applescript-support.php, they have the full instructions and example script....

February 09 2008 at 10:40 AM Report abuse rate up rate down Reply
Luke H.

Hey, nevermind, I just figured it out on my own. I went to the apple developer documentation. http://developer.apple.com/documentation/AppleScript/Conceptual/AppleScriptLangGuide/index.html :D

I changed:

tell application "Dreamweaver" to open

to:

tell application "Dreamweaver" to launch

Applications should be launched, files opened. :D

February 09 2008 at 4:39 AM Report abuse rate up rate down Reply
Luke H.

Hey!

I tried to create a simple launcher with only Dreamweaver and this is all I get! And I made very sure that it's spelt right and everything. What's wrong?

http://img137.imageshack.us/img137/4532/picture1hu9.jpg


February 09 2008 at 4:32 AM Report abuse rate up rate down Reply
rhix

Errr.. I forgot to include a url for NetworkLocation...

http://networklocationapp.com

February 05 2008 at 1:54 AM Report abuse rate up rate down Reply
rhix

If you're looking for a GUI for doing these types of things, you could check out our product, NetworkLocation, which will allow you to start applications, mount network drives, run custom scripts, and set a ton of system settings. Pretty much every request I've seen in the comments here can be handled in NetworkLocation via our easy to use GUI.

February 05 2008 at 1:50 AM Report abuse rate up rate down Reply
JK

I love applescripts so much, and it's stunning when people don't know of or use them. Thanks!

February 03 2008 at 6:10 PM Report abuse rate up rate down Reply
DanRobinson

Here's my "Good Morning" script:

tell application "Finder"
activate
set TheLocation to folder "Good Morning" of folder "Favorites" of folder "Library" of folder "daniel" of folder "Users" of startup disk
open {internet location file "MacMinute.webloc" of TheLocation, ¬
application file "Mail.app" of folder "Applications" of startup disk, ¬
application file "NetNewsWire.app" of folder "Applications" of startup disk, ¬
internet location file "The Unofficial Apple Weblog (TUAW).webloc" of TheLocation, ¬
document file "z Astronomy.url" of TheLocation}
end tell

February 03 2008 at 10:52 AM Report abuse rate up rate down Reply
Jerry

Can you make it so it opens Safari in a specific URL and Address Book in a specific contact?

Blue skies!!

February 03 2008 at 9:53 AM Report abuse rate up rate down Reply
egw

On the same kind of considerations, I just wanted to mention the excellent open-source programme Marco Polo, which is basically a location manager, but which associates with a location the notion of a task (at work, launch these apps and at home those other ones). But it can be used as a simple task switcher, even if the actual location doesn't change. At least, that's my opinion.

February 03 2008 at 9:34 AM Report abuse rate up rate down Reply
Buy an ad here

Hot Apps on TUAW

Tweets

© 2012 AOL Inc. All Rights Reserved.