"linking" applications to open and close together?

Discussion in 'Mac Apps and Mac App Store' started by jakeopolis, Nov 25, 2007.

  1. jakeopolis macrumors member

    Joined:
    Oct 27, 2007
    #1
    hey, is there a way of linking two applications so when i open or close one, the other opens or closes? specifically, this is to link youcontrol with itunes.

    thanks!
     
  2. ab2650 macrumors 6502a

    Joined:
    Jun 21, 2007
    #2
    As a work-around, you could create an Automator action that opens both apps.
     
  3. jakeopolis thread starter macrumors member

    Joined:
    Oct 27, 2007
    #3
    but then i'd have to run the workflow instead of opening the apps themselves...
     
  4. xUKHCx Administrator emeritus

    xUKHCx

    Joined:
    Jan 15, 2006
    Location:
    The Kop
    #4
    I have something similar in applescript that opens two applications and monitors them so if one closes so does the other and then itself.
     
  5. jakeopolis thread starter macrumors member

    Joined:
    Oct 27, 2007
    #5
    how did you set that up? i've never used applescript before.
     
  6. ab2650 macrumors 6502a

    Joined:
    Jun 21, 2007
    #6
    Yes, but you could export the workflow as an app, give it the iTunes icon, and put it in your dock. For the uninitated, it would look and work just like iTunes.

    The major problem I see here is when you close one of the apps, it won't automatically close the other...
     
  7. xUKHCx Administrator emeritus

    xUKHCx

    Joined:
    Jan 15, 2006
    Location:
    The Kop
    #7
    I stupidly didn't save it properly when i first made it so i just wrote this, seems to work pretty much the same way.

    Open that in script editor and replace the applications to the ones you want in this line "set applist to {"iTunes", "iCal"}" you can even add more applications to the list e.g. set applist to {"iTunes", "iCal", "Mail"}.

    Then save it as an application bundle. Then you can put it in the dock and just click on it and hopefully it will work as described above.

    EDIT: Fixed something that was broken.

    Code:
    global applist
    global apprunning
    set applist to {"iTunes", "iCal"}
    repeat with each_item in applist
    	tell application each_item to activate
    end repeat
    set apprunning to true
    repeat until apprunning is false
    	delay 3
    	tell application "System Events"
    		set processlist to get name of every process
    		repeat with every_item in applist
    			if processlist does not contain every_item then
    				my quitapps()
    			end if
    		end repeat
    	end tell
    end repeat
    
    on quitapps()
    	set apprunning to false
    	repeat with each_item in applist
    		try
    			tell application each_item to quit
    		end try
    	end repeat
    return
    end quitapps
    Top gear time so will answer any questions after that.
     
  8. !eon macrumors newbie

    Joined:
    Oct 16, 2008
    #8
    xUKHCx, it works like a charm.:D
    Thanks so much!
     
  9. dirt farmer macrumors 6502

    Joined:
    Feb 23, 2005

Share This Page