If anyone here is familiar with Mindvision Installer VISE, you’ll know that there’s a feature that it has where you can tell it to quit all running applications before continuing with the installation. Can anyone tell me if this is something that can be accomplished via Applescript? I know that I can tell an app to Quit, but VISE does all kinds of time-out checking and guarentees that it will not hang if an app gets feisty and refuses to quit. I’d like to replicate this in Applescript if at all possible.
I’m not quite sure who wrote this script but it does indeed work…
tell application "Finder"
set visible of application processes to true
delay 5 --to give the Finder time to make things visible
set appList to the name of application processes whose visible is true
end tell
repeat with aName in appList
if (aName as text) is not in {"Finder"} then
try --in case we hit something that won't quit
tell application (aName as text) to quit
end try
end if
end repeat
A special thanks to the author, who ever ye may be…
Ooops - command period didn’t stop the submit in time. Next message please…
Rob,
Just an FYI…
You might run into apps that throw a dialog because they have documents that have been modified but not saved. I’ve never experimented with this scenario but it might require the script to kill the process instead of the app - and I don’t even know if that would overcome the issue.
(assuming Mac OS X), a kill will certainly terminate the process, but at the expense of trashing any unsaved user documents. I’m 99.99% sure that VISE tells apps to quit rather than forces them to, and gives them the opportunity to save documents, interact with the user, etc.
The only thing that’s missing from the earlier script is a check to make sure the apps have quit. A simple repeat loop or idle handler would take care of that.