• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: tell application "<some application>" to quit...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tell application "<some application>" to quit...


  • Subject: Re: tell application "<some application>" to quit...
  • From: Paul Berkowitz <email@hidden>
  • Date: Sat, 01 Sep 2001 09:27:40 -0700

On 9/1/01 10:12 AM, "Bob.Kalbaugh" <email@hidden> wrote:

> Is there *one* method for quitting *all* apps in an open, unsaved documents
> situation?
>
> Thanks for answering any of the above. My guesses are:
> Developers' discretion, yes, and no. I hope I've got 'em all wrong.

Why not do this? This should work in most scriptable apps, but you really do
need to check their dictionaries to see if they have 'window'.

tell app "whatever"
activate -- for those that need it
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
quit
end tell


Since they _won't_ all have windows, I guess you'd better do this:

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



--
Paul Berkowitz


  • Follow-Ups:
    • Re: tell application "<some application>" to quit...
      • From: Emmanuel <email@hidden>
    • Re: tell application "<some application>" to quit...
      • From: "Bob.Kalbaugh" <email@hidden>
References: 
 >tell application "<some application>" to quit... (From: "Bob.Kalbaugh" <email@hidden>)

  • Prev by Date: tell application "<some application>" to quit...
  • Next by Date: OS X Scripting: Vol 2 #1023
  • Previous by thread: tell application "<some application>" to quit...
  • Next by thread: Re: tell application "<some application>" to quit...
  • Index(es):
    • Date
    • Thread