How do i get Steve's nifty AppleScript?

Discussion in 'macOS' started by daneoni, Feb 1, 2007.

  1. daneoni macrumors G4

    daneoni

    Joined:
    Mar 24, 2006
    #1
    I just watched the last WWDC Keynote and after demoing spaces, Steve clicks on an AppleScript icon in the Dock that quit all the open applications he was running at the time.

    I NEED that. Any idea how to get this?
     
  2. gauchogolfer macrumors 603

    gauchogolfer

    Joined:
    Jan 28, 2005
    Location:
    American Riviera
    #2
    I recall that being figured out here on the Forums. Try a search and see if you get anything...
     
  3. daneoni thread starter macrumors G4

    daneoni

    Joined:
    Mar 24, 2006
    #3
    Just searched and can't seem to find anything related.
     
  4. GimmeSlack12 macrumors 603

    GimmeSlack12

    Joined:
    Apr 29, 2005
    Location:
    San Francisco
    #4
    You're probably looking in the wrong place.
    www.macscripter.net should get you on the right track.
     
  5. fivetoadsloth macrumors 65816

    fivetoadsloth

    Joined:
    Aug 15, 2006
    #5
    i too would be interested, i looked at the suggusted site but didnt see anything, maybe i mised it though.
     
  6. lancestraz macrumors 6502a

    lancestraz

    Joined:
    Nov 27, 2005
    Location:
    RI
    #6
    Something like this:
    Code:
    set white_list to {"Finder"}
    
    try
    	tell application "Finder"
    		set process_list to the name of every process whose visible is true
    	end tell
    	repeat with i from 1 to (number of items in process_list)
    		set this_process to item i of the process_list
    		if this_process is not in white_list then
    			tell application this_process
    				quit
    			end tell
    		end if
    	end repeat
    on error
    	tell the current application to display dialog "An error has occurred!" & return & "This script will now quit" buttons {"Quit"} default button 1 with icon 0
    end try
    This will not quit any applications that are "hidden".
    You can change the variable "white_list" to suit your needs.
     
  7. Eusebius macrumors member

    Joined:
    Dec 9, 2006
    #7
    Click the following link:

    applescript://com.apple.scripteditor/?action=new&script=tell%20application%20%22System%20Events%22% 20to%20set%20theApps%20to%20%28name%20of%20every%2 0process%20whose%20visible%20is%20true%20and%20nam e%20is%20not%20%22Finder%22%20and%20name%20is%20no t%20%28my%20name%20as%20text%29%29%0D%0Drepeat%20w ith%20theApp%20in%20theApps%0D%09tell%20applicatio n%20theApp%20to%20quit%0Dend%20repeat%0D

    Once you click the link above, Script Editor on your machine will have the script in a window. Save it to ~/Library/Scripts as an application, giving it any name you want, like Quit All Apps. Then open /Applications/Applescript/Applescript Utility and check the box that is labeled Show Script Menu In Menu Bar and quit Applescript Utility.

    Now any time you want to quit all apps except hidden, background, Finder, and Script Editor, then just choose the script from the Script Menu in the upper right on the menu bar.

    If you want to "unhide" all hidden apps so they would get quitted also, you would add the line

    tell application "System Events" to set the visible of every process to true

    at the beginning of the script.
     
  8. daneoni thread starter macrumors G4

    daneoni

    Joined:
    Mar 24, 2006
    #8
    Tried this but it wont let me save and gives an error

    This seems to work BUT should i save it as an App or just a script. I saved it as an App in /Library/Scripts/

    Thanx for all help thus far by the way
     
  9. lancestraz macrumors 6502a

    lancestraz

    Joined:
    Nov 27, 2005
    Location:
    RI
    #9
    If you save it as a script (not an app) in "Library>Scripts" you can access it from the script menu.
    It you save it as an application you can run it by simply double clicking on it's icon.

    So whatever is more convenient for you. :)
     
  10. daneoni thread starter macrumors G4

    daneoni

    Joined:
    Mar 24, 2006
    #10
    Thanx. Do you happen to have one that hides/close all open apps' windows instead of quitting them?, this along with the above one would be life savers.
     
  11. daneoni thread starter macrumors G4

    daneoni

    Joined:
    Mar 24, 2006

Share This Page