Open several apps and docs with a double-click

May 17, '04 10:12:00AM

Contributed by: dtannenbaum

I work on a project that requires me to open several applications and documents at once, and it's a pain to hunt around for everything or clutter my desktop with aliases. To solve the problem I created a *very* simple script that opens everything I need in one shot. Here's how:

  1. Open any text editor that can create plain text files and create a new document.
  2. For each application you want the script to open, type a line that reads: open /Applications/ApplicationName.app. For some applications, you don't need the .app, and for applications that aren't in your Applications folder, you'll need to enter the appropriate path. One way to figure out the appropriate path is to open a new window in Terminal (in Applications -> Utitlies) and drag the file in question over it. The path will print out automatically, and you can copy this text into the script.
  3. Documents can be trickier because they often have spaces in their names. If they do, add the escape character before each space. For example:
    open /Users/davidtdphil/Desktop/Thesis\ Bibliography.enl
    
  4. Save the document as a plain text file (ASCII) and append .command to the name. For example, myscript.command.
  5. Open a new window in Terminal and type chmod 774 (notice the trailing space!). Don't press return yet. Instead, drag the file you've just saved over the terminal window. Its path will print out automatically. Now you can hit Return. This step makes the file executable for you and others in your group. Everyone else can just read it.
Voila! Your timesaving script is born. Now you can double-click this file, and every item you specified in the script will open. To change the items, you can open the script from within any text editor.

[robg adds: When I have batches of stuff like this to open for certain projects, I tend to just create project folders, each containing aliases of the apps and/or documents that I want to open. I can also use Butler to create groups of items that launch and/or open when activated via a hot key. However, the above is a good example of how to use the Terminal's Finder integration to build a simple launcher script.]

Comments (10)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20040513195649489