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:

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).

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!
Share
Source: http://tuaw.com/tag/applescript
Categories
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
Is there a way i can have apps run in different spaces?
February 26 2008 at 4:18 AM Report abuse Permalink rate up rate down ReplyIf 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....
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
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
Errr.. I forgot to include a url for NetworkLocation...
http://networklocationapp.com
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 Permalink rate up rate down ReplyI 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 Permalink rate up rate down ReplyHere'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
Can you make it so it opens Safari in a specific URL and Address Book in a specific contact?
Blue skies!!
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 Permalink rate up rate down ReplyHot Apps on TUAW
Deals of the Day
more deals- Verizon Leather Sleeve for Tablets for $4 + free shipping
- Wicked Jaw Breaker Noise-Isolating In-Ear Headphones for $6 + free shipping
- Refurb Apple MacBook Air Laptops: 12" 64GB SSD for $699 + free shipping
- JVC Motion Sensing Clock Radio with Dual iPod Docks for $55 + free shipping
- Apple iPhone Headset with Mic for $4 + $2 s&h
- Refurb Apple iPod nano 8GB MP3 Player for $99 + free shipping, 16GB for $119
Software Updates
more updates- EFI Firmware Update brings Lion Internet Recovery to 2010-model Macs
- OS X Lion 10.7.3 released with Safari 5.1.3, Wi-Fi bug fix
- Aperture updated to 3.2.2, addresses Photo Stream issue
- Apple updates Keynote to address Lion issues
- Google Search app gets new look on iPad
- Apple releases Apple TV Software Update 4.4.3



25 Comments