Re: tell application "<some application>" to quit...
Re: tell application "<some application>" to quit...
- Subject: Re: tell application "<some application>" to quit...
- From: Emmanuel <email@hidden>
- Date: Sun, 2 Sep 2001 11:58:03 +0200
At 18:27 +0200 1/09/01, Paul Berkowitz wrote:
>
tell app "whatever"
>
activate -- for those that need it
>
try
>
set n to (count windows)
>
repeat with i from n to 1 by -1
>
set theWindow to window i
>
close theWindow saving no
>
end repeat
>
on error
>
beep 3 -- get your attention for the next command!
>
end try
>
quit
>
end tell
In fact, it would be more advisable to be still more prudent.
It can happen that when you close a given window, some other window[s] get
closed automatically. "close" can decrement the number of windows by more
than one. Your proposition would leave some windows opened.
It might be better to 1. build the list of the windows, 2. try gently to
close each one.
----------------- much tested ...
tell app "whatever"
repeat with theWind in (every window as list)
set theWind to contents of theWind
try
tell theWind to close it saving no
end try
end repeat
end
-----------------
Emmanuel