Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JonnyBlaze

macrumors 6502
Original poster
May 5, 2008
291
280
UK
Hello,

as the title suggests, I'm looking for a way to open 2 programs at the same time when I click one from the dock.
My example is opening Spotify, and I want Airfoil to open at the same time to stream the audio.

Thanks in advance for any ideas.

Jon
 
One way is to use AppleScript. Open up 'AppleScript Editor' in Utilities.

Put this code in the blank document:
Code:
tell application "Spotify" to activate
tell application "Airfoil" to activate

Then go to save, select the file format as 'Application'. Only 'Run Only' should be checked. Then put that app in your dock.
 
Record it with AppleScript, save the script as application and then put its icon in the dock...


---
edit: only seconds late...
 
You could create an application in Automator that will open both programs on a single click. Obviously have the corresponding apps in the correct sections. Once you have saved the application put it on the dock and it should work nicely.
 

Attachments

  • Screen shot 2009-10-30 at 10.00.37.png
    Screen shot 2009-10-30 at 10.00.37.png
    28.1 KB · Views: 100
Thanks very much for the speedy replies...I'll have a go this afternoon. Hope all goes to plan!

Jon


Edit:

Well I shouldn't have doubted that it would be easy, never mind trying this afternoon, it only took a minute!

I've done it with the script editor, and with automator as well. Not having used either of these before, what the difference between them? It doesn't seem to make much difference which one you use for this example?

Thanks again though for your help.

Jon
 
I've done it with the script editor, and with automator as well. Not having used either of these before, what the difference between them? It doesn't seem to make much difference which one you use for this example?

Automator is essentially a nice package that does all it's work via Applescript. Anything you can write in Applescript you can in Automator and vice versa, although much of the commands are premade, drag and drop and just plain easy.
 
Automator is essentially a nice package that does all it's work via Applescript. Anything you can write in Applescript you can in Automator and vice versa, although much of the commands are premade, drag and drop and just plain easy.

This is a bit off. You can do a lot of stuff with automator, but it cannot do anything I can write in Applescript.

Sure basic things like "Launching an Application." Or a folder action. But by no means anything Applescript can do.
 
Hello again,

after managing to open 2 programs simultaneously, I'm wondering about other uses for scripts/automator.

The way I use airfoil, is to stream audio from 1 specific program (spotify or VLC usually) rather than all system audio. Now, is it possible to use scripts/automator, to open the two programs simultaneously, and specify that the program opened alongside Airfoil is the one it should stream from?

This would be useful, as Airfoil by default chooses the last opened program. I imagine this is getting a bit more complex, so a yes/no answer will be fine if explainations will be too lengthy. Maybe someone could point me in the direction of a good guide to scripts/automator also.

Thanks very much for the help.

Jon
 
This is a bit off. You can do a lot of stuff with automator, but it cannot do anything I can write in Applescript.

Sure basic things like "Launching an Application." Or a folder action. But by no means anything Applescript can do.

Look up "Run AppleScript" in the Automator Library :D
 
Thanks for everyones suggestions! It really didn't take long to get my head around this, but there were a few key places I found to help me.

After having read on the Airfoil website about their scripts, and some great guides on this site http://mac.appstorm.net/ I've written the script to open Spotify and Airfoil, and automatically transmit audio from Spotify!

Thanks again, and in case anyone's interested I've included the script as text below...



AppleScript to open Spotify and Airfoil, and stream audio from Spotify.

tell application "Spotify" to activate
tell application "Airfoil" to activate

tell application "Airfoil"
set aSource to make new application source
set application file of aSource to "/Applications/Spotify.app"
set current audio source to aSource

end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.