From: Chris Degnen on 10 Feb 2010 03:36 Hi. Is it possible to run a command upon system close? The 'close' menu binding is customisable but doesn't seem to accept a sequence of tokens, e.g. Item["E&xit", KernelExecute[CustomFunction[]]; "FrontEndQuit"] The top-right close button isn't affected by the menu binding though. Thanks in advance.
From: Szabolcs Horvát on 11 Feb 2010 05:15 On 2010.02.10. 9:36, Chris Degnen wrote: > Hi. Is it possible to run a command upon system close? > > The 'close' menu binding is customisable but doesn't seem to accept a > sequence of tokens, e.g. Item["E&xit", > KernelExecute[CustomFunction[]]; "FrontEndQuit"] > > The top-right close button isn't affected by the menu binding though. > $Epilog is evaluated on kernel quit. I don't think there is anything similar for the front end quit.
From: Chris Degnen on 12 Feb 2010 04:40 Thanks. Actually I got most of the way there. I just added FrontEndExecute[FrontEndToken["FrontEndQuit"]]; to the end of the function I wanted to run, then added a menu bar item to run the function. E.g. to ....\SystemFiles\FrontEnd\TextResources\Windows\MenuSetup.tr I added: Item["Exit", KernelExecute[Get["CustomFunction`"]], MenuEvaluator->Automatic] I would like to place the menu item over on the right, under the window-close button on the frame. I tried Alignment->Right but it won't budge. Any suggestions? Szabolcs Horv=E1t wrote: > Chris Degnen wrote: > > > Hi. Is it possible to run a command upon system close? > > > The 'close' menu binding is customisable but doesn't seem to > > accept a sequence of tokens, e.g. Item["E&xit", > > KernelExecute[CustomFunction[]]; "FrontEndQuit"] > > > The top-right close button isn't affected by the menu binding though. > > $Epilog is evaluated on kernel quit. I don't think there is anything > similar for the front end quit.
|
Pages: 1 Prev: LogPlot is blank when Exported as pdf Next: Checking that MathKernel is still running |