Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Enthusiast Zone > Classic Macs and Mac OS > Applescript to quit running apps

Applescript to quit running apps
Thread Tools
k3vmo
Fresh-Faced Recruit
Join Date: Aug 2002
Status: Offline
Reply With Quote
Aug 14, 2002, 07:56 PM
 
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
Junior Member
Join Date: Dec 1999
Location: USA
Status: Offline
Reply With Quote
Aug 16, 2002, 05:33 AM
 
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
( Last edited by Tom_O; Aug 16, 2002 at 06:20 AM. )
     
palws
Fresh-Faced Recruit
Join Date: Oct 1999
Status: Offline
Reply With Quote
Aug 17, 2002, 02:36 AM
 
Yo Tom_0.

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

Bill
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 04:32 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,