• 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
Multi-purpose Quit handler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multi-purpose Quit handler


  • Subject: Multi-purpose Quit handler
  • From: pete boardman <email@hidden>
  • Date: Sat, 22 Oct 2005 11:06:03 +0100

I'm trying to write a script that I can run as a multi-purpose Quit handler. I can run it using a system-wide keyboard shortcut, and it will do auxiliary tasks depending on which application I'm quitting from.

--
tell application "System Events"
set fap to first application process whose frontmost is true
activate
display dialog "Are you sure you want to quit " & name of fap & "?" buttons {"Yes", "No"} default button "Yes"
end tell
if button returned of result is "Yes" then
tell fap to quit saving ask
end if
--


It often goes wrong, with a:

System Events got an error:
NSReceiversCantHandleCommandScriptError

I think I can see the problems (trying to quit the process running the script?) but can't solve it.


Pete _______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Finding \t, \r, \n reliably
  • Next by Date: What have I done? / do shell script mystery
  • Previous by thread: Re: Setting the desktop picture on second monitor.
  • Next by thread: Case sensitivity of text item delimiters
  • Index(es):
    • Date
    • Thread