Apple Script, make apps quit after activate

Discussion in 'Mac Programming' started by Sverkel, May 1, 2016.

  1. Sverkel macrumors regular

    Sverkel

    Joined:
    Jul 3, 2007
    Location:
    Denmark
    #1
    Hi. So I got my new 27" Dell monitor and I have noticed that when I resize my apps on my MacBook Air when connected to the monitor the apps no longer fill the screen on the MacBook Air when not connected to the monitor and the other way around. So i'm trying to make a "fix" with some Apple Script. As of now I have made two apps, the one resizes the apps to the size I like when connected to the monitor and the other one for the MacBook Air. But when I activate the script it opens all the apps I have chosen, so here comes my question. Is there some way I can tell the same script to close the apps after the have been activated?

    As of now I got this code in my script.

    Code:
    tell application "lala1" to activate
    tell application "lala2" to activate
    tell application "lala3" to activate
     
  2. 0d085d macrumors regular

    Joined:
    Apr 23, 2015
    #2
    Just:

    Code:
    tell applicaton "lala1" to quit
    or have I misunderstood your problem?

    You might need to add a few delays in there just to let the application load etc.

    Code:
    tell application "lala1" to activate
    tell application "lala2" to activate
    tell application "lala3" to activate
    delay 5
    tell application "lala1" to quit
    tell application "lala2" to quit
    tell application "lala3" to quit
    
     
  3. Sverkel, May 1, 2016
    Last edited: May 1, 2016

    Sverkel thread starter macrumors regular

    Sverkel

    Joined:
    Jul 3, 2007
    Location:
    Denmark
    #3
    I tried that but it won't work :(

    Got it to work! Just had to replace the lala part with the actual app name that had to be closed ;)

    Thank you! :)
     

Share This Page