Automatically run an app when another is opened?

lpobsession2005

macrumors member
Original poster
Jan 8, 2010
58
0
Pretty Self explanatory. I want to Click one program, and have that program and another open at the same time. In my case, When I open iTunes, I want Bowtie to open also.
 

lpobsession2005

macrumors member
Original poster
Jan 8, 2010
58
0
Create a simple AppleScript that will open both and run that instead of iTunes.
Alright... do you happen to know what that script is? I tried to search and post a topic elsewhere in this forum asking for such a script and I got no answers
 

robbieduncan

Moderator emeritus
Jul 24, 2002
24,638
61
Harrogate
Alright... do you happen to know what that script is? I tried to search and post a topic elsewhere in this forum asking for such a script and I got no answers
Yes, but think how more satisfying it would be for you to do a tiny amount of research and work it out for yourself. The most basic of AppleScript will activate (this word is itself a hint) and application.

A very quick Google search brings up this tutorial.
 

lpobsession2005

macrumors member
Original poster
Jan 8, 2010
58
0
Yes, but think how more satisfying it would be for you to do a tiny amount of research and work it out for yourself. The most basic of AppleScript will activate (this word is itself a hint) and application.

A very quick Google search brings up this tutorial.
Thanks... lol. I did do some research I couldnt find anything though. I never post anything in forums unless I've already looked hard to find it myself
 

lpobsession2005

macrumors member
Original poster
Jan 8, 2010
58
0
That video worked well. Thanks! It didnt explain exactly what i needed but what I did was type

tell application "iTunes"
activate
end tell
tell application "Bowtie"
activate
end tell

Then saved it as an application and just replaced the iTunes shortcut in my dock with the script and change the icon. GREAT thanks!
 

lpobsession2005

macrumors member
Original poster
Jan 8, 2010
58
0
actually... now Im presented with kind of another problem... I have two iTunes icons in my dock lol. Is there a way to just make itunes run an activate command on bowtie when it opens? Like a sort of command like this

Tell application "iTunes"
upon activate
tell appliaction "bowtie"
activate
end tell

Or is there some folder inside Itunes that has a list of default scripts it opens that i can insert my own into? I've been looking for either that or a list somewhere that points to scripts but i cant find anything
 

lpobsession2005

macrumors member
Original poster
Jan 8, 2010
58
0
or... maybe I can make a script that runs every time I start my computer, that just waits for iTunes to open and when it does it will open bowtie? anyone?
 

mysterytramp

macrumors 65816
Jul 17, 2008
1,335
3
Maryland
The problem with your question is that you're heading toward an idle script and AppleScript just doesn't handle those very well (unless you've got a fairly decent processor, and even if you do, you might not be happy with the performance).

Essentially, you'll create a script that says something like:

Code:
on idle
	tell application "System Events"
		set x to the number of processes
		repeat with n from 1 to x
			if (name of process n) is "iTunes" then
				tell application "Bowtie" to activate
			end if
		end repeat
	end tell
end idle
I don't have Bowtie loaded so I can't test this.

And I couldn't find a simpler way of assuring that iTunes was working without testing the name of each process.

This will run every 30 seconds.

mt
 

lpobsession2005

macrumors member
Original poster
Jan 8, 2010
58
0
The problem with your question is that you're heading toward an idle script and AppleScript just doesn't handle those very well (unless you've got a fairly decent processor, and even if you do, you might not be happy with the performance).

Essentially, you'll create a script that says something like:

Code:
on idle
	tell application "System Events"
		set x to the number of processes
		repeat with n from 1 to x
			if (name of process n) is "iTunes" then
				tell application "Bowtie" to activate
			end if
		end repeat
	end tell
end idle
I don't have Bowtie loaded so I can't test this.

And I couldn't find a simpler way of assuring that iTunes was working without testing the name of each process.

This will run every 30 seconds.

mt
Doesn't seem to work at all :(
 

mysterytramp

macrumors 65816
Jul 17, 2008
1,335
3
Maryland
You need to save it as a Stay Open application also.

And it might not work ... without Bowtie, I'm working from a disadvantage. If Bowtie isn't scriptable, it won't know what an activate message is.

mt