6
$\begingroup$

This is probably fairly straightforward, but I wasn't able to find it right away. I'd like for Mathematica to display on startup the latest notebook I was working on, and nothing else. No additional old notebooks and no new blank notebook. There is probably an option hiding somewhere to do that, but I wasn't able to find it. Apologies if this is too simple.

$\endgroup$
2
$\begingroup$

R.M beat me but I'll post this anyway for variety.

You can open the last Notebook with:

Options[$FrontEnd, NotebooksMenu][[1, 2, -1, 2, 1]] // NotebookOpen

Methods for preventing the opening of a blank Notebook, for both version 7 and 8 are here:

How do I prevent auto loading of blank notebook at startup?

$\endgroup$
6
$\begingroup$

The list of recently opened notebooks (as shown in File > Open Recent) is saved in the NotebooksMenu option for $FrontEnd, arranged by ascending absolute time (i.e., most recent is last). So the most recent notebook can be opened with:

Last[NotebooksMenu /. Options@$FrontEnd] /. 
    HoldPattern[_ -> {file_, ___}] :> NotebookOpen@file

Some additional related questions that might of interest are:

$\endgroup$
  • $\begingroup$ Thanks, I always get the last notebook opened, I was mainly interested in avoiding the automatic opening of all other notebooks, especially the blank one. $\endgroup$ – Moshe Oct 13 '12 at 19:00
  • $\begingroup$ @Moshe that is answered here: mathematica.stackexchange.com/q/1383/121 $\endgroup$ – Mr.Wizard Oct 13 '12 at 19:03
  • $\begingroup$ @Moshe Mr.Wizard's link answers that specific question. A complementary question then, is to open just a specific notebook each and every time. That is answered here: mathematica.stackexchange.com/q/8316/5 $\endgroup$ – rm -rf Oct 13 '12 at 19:04
  • $\begingroup$ @Mr.Wizard, thanks, I'll take a look. Maybe my question can be closed as a duplicate then. $\endgroup$ – Moshe Oct 13 '12 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.