MacNN Forums (http://forums.macnn.com/)
-   Classic Macs and Mac OS (http://forums.macnn.com/classic-macs-and-mac-os/)
-   -   Applescript to quit running apps (http://forums.macnn.com/64/classic-macs-and-mac-os/118621/applescript-to-quit-running-apps/)

 
k3vmo Aug 14, 2002 07:56 PM
Applescript to quit running apps
I have a script that will trash certain items on the hard drive. To be safe I want to make sure no applications are running especially the one I want to remove.
The problem is, some applications like IE don't respond to the quit event under OS 9.2.2 using Applescript 1.8.3

Here's what I have, and it returns that Internet Explorer doesn't understand quit

tell application "Finder"
try
set visible of every process to true
end try

set app_list to name of every process whose visible is true
repeat with anApp in app_list
tell anApp to quit

end repeat
end tell

Is there any better way to close all running applications? This will run under OS 9 only so I'm not worried about X compatibility
Esentially I only want my script and the finder running when it begins to remove files from the hard drive.
 
Tom_O Aug 16, 2002 05:33 AM
Re: Applescript to quit running apps
Try "Quit All" written by Satoshi Matsumoto.   Good luck.
http://www.matsumoto.co.jp


property theAppList : {}
property theTimeout : 3

tell application "Finder"
copy (count of process) to maxNum
set theAppList to {}
repeat with num from 1 to maxNum
copy file type of process num to theType
if theType is "APPL" then
if process num is not frontmost then
copy name of process num to theApp
copy theAppList & theApp to theAppList
end if
end if
end repeat
end tell

copy the (length of theAppList) to maxNum

repeat with num from 1 to maxNum
copy item num of theAppList to theApp
tell application "Finder"
copy visible of process theApp to theStat
if theStat is false then
try
set visible of process theApp to true
end try
copy visible of process theApp to theStat
end if
end tell
if theStat is true then
tell application "Finder" to set frontmost of process theApp to true
try
with timeout of theTimeout seconds
tell application theApp to quit
end timeout
end try
end if
end repeat
 
palws Aug 17, 2002 02:36 AM
Yo Tom_0.

How are you doing young man? Answer your email bud. <gr>

Bill
 
All times are GMT -4. The time now is 02:39 AM.

Copyright © 2005-2007 MacNN. All rights reserved.
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2014, vBulletin Solutions, Inc.


Content Relevant URLs by vBSEO 3.3.2