Re: Quiting Appz but not finder
Re: Quiting Appz but not finder
- Subject: Re: Quiting Appz but not finder
- From: Nigel Garvey <email@hidden>
- Date: Tue, 13 Mar 2001 13:49:03 +0000
"Jiri D. Hoogeveen" wrote on Mon, 12 Mar 2001 16:43:35 +0100:
>
Hello,
>
>
I'm using system 9.1 and I'm trying to make a script so that all the app
>
quit but not the finder. And no I don't wanne do a restart.
>
>
I have this script but it is killing my Finder and no other app.
>
>
tell app "FInder"
>
activate
>
tell (every app where the name is not "Finder") to quit
>
end tell
Using 'quit' anywhere inside a Finder 'tell' block is a known way of
getting the Finder itself to quit, even in a nested 'tell' statement. You
need to use the Finder to get the names of all the current processes (the
Finder itself is not one of these) and then quit them by name outside the
Finder block. The script I use leaves invisible background processes in
place and quits applications in reverse order of opening, to try and
minimalise the memory fragmentation. (Watch out for the line wrap.):
try
get the path to me
tell application "Finder"
set myName to the name of the result
get (the name of every process whose file type is "APPL" and name
is not myName) as list
end tell
repeat with thisName in the reverse of the result
tell application thisName to quit
end repeat
on error
end try
NG