View Single Post
Mark FX

 
Mark FX's Avatar
 
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 167
Mark FX has a spectacular aura about

Mark FX is offline
I have done a fair bit of Applascript, and I can tell you there is no better way with Applescript.
As for Xcode it does not have any quick ways to do what you want, dvelopers did use the keystroke cmd-o, but this does not minimize windows, but hides them, this technique is not avised by apple, or me.
I have tried this simular script to yours, and it closed five apps in about one minute, so you must have a lot of apps running.
Code:
tell application "System Events"
	set visible_app_list to every application process whose visible is true
	repeat with visible_app in visible_app_list
		tell application process visible_app
			activate
			click (first button of every window of visible_app whose role description is "minimize button")
		end tell
	end repeat
end tell
You have to remember to have GUI scripting enabled in System Preferences.

Also bare in mind, that different apps take a different amount of time to quit

regards Mark
QUOTE Thanks