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

tonywang.xmpt

macrumors member
Original poster
Jul 26, 2010
78
0
US
I'm currently trying to create an application script that allows me to open Bowtie automatically when I open iTunes
and quit Bowtie when I quit iTunes.

Here is my current code that I'm using
Code:
property app01 : "Bowtie"
property app02 : "iTunes"
property tDelay : 3

on run {}
	tell application app01 to activate
	tell application app02 to activate
end run

on idle {}
	tell application "System Events" to set pNames to name of processes
	
	if (not (pNames contains app01) and (pNames contains app02)) then
		tell application app02 to quit
		tell me to quit
	end if
	return (tDelay)
end idle

The problem with this code is that it'll successfully open Bowtie when I open iTunes
but I cannot get it to quit Bowtie when I quit iTunes.
The Bowtie is still in the Activity Monitor processes.

Please help me with my dilemma.
Thanks
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.