Automatically run an app when another is opened?

Discussion in 'Mac Apps and Mac App Store' started by lpobsession2005, Apr 2, 2010.

  1. lpobsession2005 macrumors member

    Joined:
    Jan 8, 2010
    #1
    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.
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Create a simple AppleScript that will open both and run that instead of iTunes.
     
  3. lpobsession2005 thread starter macrumors member

    Joined:
    Jan 8, 2010
    #3
    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
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    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.
     
  5. lpobsession2005 thread starter macrumors member

    Joined:
    Jan 8, 2010
    #5
    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
     
  6. lpobsession2005 thread starter macrumors member

    Joined:
    Jan 8, 2010
    #6
    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!
     
  7. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #7
    Great :D I'm happy that you've both got what you wanted working and learnt something too :)
     
  8. lpobsession2005 thread starter macrumors member

    Joined:
    Jan 8, 2010
    #8
    lol, tough love
     
  9. lpobsession2005 thread starter macrumors member

    Joined:
    Jan 8, 2010
    #9
    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
     
  10. lpobsession2005 thread starter macrumors member

    Joined:
    Jan 8, 2010
    #10
    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?
     
  11. mysterytramp macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #11
    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
     
  12. lpobsession2005 thread starter macrumors member

    Joined:
    Jan 8, 2010
    #12
    Doesn't seem to work at all :(
     
  13. mysterytramp macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #13
    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
     

Share This Page