I have a conundrum.
I use an iMac's OS X 10.6.8 settings to start and stop the machine at the specific times that I need a particular notebook to run. I've done this because it has worked more reliably then timed events. Mathematica launches automatically when my computer boots and the notebook with all its cells set as
Initialization Cells launches automatically and evaluates when Mathematica starts.
The last expression in the notebook:
as evident, saves this active notebook. I need this because some graphics in the notebook change and I want to review them later.
This notebook will be the only open notebook at the time of its evaluation.
So far so good.
Now I want the notebook to programmatically quit the Mathematica
This gets tricky and presents (at least) 2 problems:
begins the process, but gives me the following popup window:
This doesn't help me, because I want this to run on its own and as stated above I have an OS setting that will shut down the computer soon after Mathematica would quit.
I won't have anyone in front of the computer to click "OK" and thereby allow the shutdown to proceed. No click no shutdown.
All of the notebooks cells, including the one with the:
set as Initialization Cells presents another problem. IF I can find a work-around for the popup warning above, I still need a way to break, abort, or interrupt the flow of control so I don't have a notebook, which will always open, evaluate, then quit Mathematica. At some point I'll want it to stay open to edit or change the code.
I've looked at variations of:
NotebookSave Interrupt; FrontEndTokenExecute["FrontEndQuit"]
They give me a popup window like this:
Pressing "Continue" or "Abort" just gives me the same popup window ("The notebook ..... contains a running evaluation...." as I had in "Problem 1".
If my solution in doing this includes automatically opening and evaluating the notebook I think I need some way to have a button or popup window come up which gives me a period of time, say 30 seconds to abort the closing of the application and its notebook. If no one aborts the process before 30 seconds I'd want the machine to shut down.
Is such a thing even possible given what I've found above?
Do I need to consider dispensing with the FrontEnd for this altogether? If yes, can someone point me in the right direction? At least for now I'd feel content if I can rely upon the OS to boot and shut down the computer so I guess I could launch the code when the computer boots. This way I wouldn't need to worry about recurring timers, that to date have proven unreliable.
The notebook in question does a lot of different stuff: opening parallel kernels, lots of parallel mapping, creating graphics, and emailing results both text and graphics. Is it even feasible for this kind of complication to run as a script on booting of the computer?
Stumped and looking for some guidance.