Checking for 'quit' and aborting shutdown

Richard Gaskin ambassador at fourthworld.com
Mon Dec 2 13:34:30 EST 2013


Graham Samuel wrote:

 > On 2 Dec 2013, at 15:39, Richard Gaskin wrote:
 >>
 >> Would shutdownRequest cover what you need?
 >>
 > No, that's sent when the user chooses 'quit', and it's also sent
 > when OSX chooses 'quit' for you, i.e. when someone chooses 'Shut
 > Down' in the main menu of the machine. So my script can't say "I'll
 > ask my user nicely if he/she really wants to shut down, unless
 > it's an order from OSX High Command, in which case I'll just cave
 > in and do it". I suppose there may be something one can do with Apple
 > Events, but then I'd be left with the same issue on the PC. Maybe
 > asking "are you sure?" should be deprecated.

Looks like apps get an Apple event of 'shut' for shutdown (this is old, 
but page 8-8 should probably still be relevant as far as the AE 
constants are concerned):
<https://developer.apple.com/legacy/library/documentation/mac/pdf/Processes/Shutdown.pdf>


Not sure what to do on Win or Linux, though on Linux there's probably a 
signal code you could trap for.


--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  Follow me on Twitter:  http://twitter.com/FourthWorldSys





More information about the Use-livecode mailing list