Macos – How to launch second process of a program from Spotlight on Snow leopard

macmacososx-snow-leopardspotlight

I usually launch programs from Spotlight, and there is one program that I want to launch second process. The program in particular is Mathematica. The second process of Mathematica allows me to keep working on while the first process is tied up to evaluation of some expressions, which take a long time to compute. Furthermore, it is also beneficial that global variables are not shared between two notebooks.

I can launch the first process of Mathematica from Spotlight without a problem. However, when I select Mathematica in Spotlight for the second time, it does not launch the second process. Instead, it focuses on a window of the first Mathematica process. I know I can launch the second process from command line by invoking

/Applications/Mathematica.app/Contents/MacOS/Mathematica

However, I do not want to use command line if possible. I also observe similar behavior in a different program (Adobe Reader), so I guess this is how Spotlight behaves by default. Is there anything that I can do to let Spotlight launch another process of a program instead of focusing on an existing window? If so, how can I do that?

Best Answer

There is nothing you can do to achieve this. Applications are not usually meant to be launched multiple times. Some, like Safari 5, TextMate, or iTunes behave oddly or prevent this completely.

But you can wrap that command-line call of yours, or preferably the better supported way

open -n -a Mathematica

in an Automator script. This way, you can launch a program, or run a Service that launches the second Mathematica instance.


To do this, open Automator, select either Application or Service, double-click the Run Shell Script action in the Library on the left, and add your command-line call to it. I suggest you use mine, because it returns immediately after launching the program. If it's a service, select that it receives no input in any application.

Now save it. If it's an application, store it anywhere and drag it e.g. to the Dock, the Finder toolbar or Finder sidebar for quick access; if it's a service, it's in the Services sub-menu of the application menu. You can even assign a keyboard shortcut in System Preferences » Keyboard » Keyboard Shortcuts » Services.

Related Question