Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I run Mathematica on an iMac running OS X 10.6.8.

I have set the OS's "Launch Items" to include Mathematica so that the application opens when the computer boots.

Now I want to go further and set Mathematica to launch a specific notebook on startup.

Note: this note book has initialization cells so it will evaluate automatically. All of this goes to my ongoing automation of a variety of processes to run while I take a few days of vacation (IF I can get this working ;-)

I've searched Mathematica's "Preferences" and "Options", but haven't found anything to identify or set a specific notebook to launch when Mathematica starts.

If someone knows a way to do this that I haven't seen in these, please advise.

The following link to an old StackOverflow question, mathematica start front end and eval notebook from command line looks like it provides a way to do what I want to do, but on a Windows OS.

As I think about applying or translating this idea to my iMac, it seems like rather than having Mathematica as a "Launch Item", I have a couple of other possibilities:

  • setup a shell script using something like OS X's launchD to launch Mathematica and a specific notebook OR
  • use MathematicaScript to launch just the kernel and run the code currently in the desired notebook.

Neither of these are strong points. Can anyone recommend a way to do this or on Mac OS X 10.6.8 or some specific references that would help me learn what I need to do?


A bit of a footnote for some additional context. The notebook I need to run launches parallel kernels on a couple of servers. I've chosen this path of getting all of this to run on the machines' startup rather than putting all of this on a timer or even logging on remotely to run them because, I've found that (at least for now) restarting both Mathematica on the client machine and as parallel kernels on the servers just runs more reliably. It particularly avoids problems with kernels that haven't launched or some of which have shut down.

The Mac OS has a very reliable method to launch and shutdown the machines at specific times. As I need the code in the notebook to run at specific times this seems like a good thing on which to layer the other functionality.

share|improve this question
add comment

1 Answer 1

up vote 11 down vote accepted

You can use the global AutoOpenNotebooks setting to give a list of notebooks that must be opened on startup. The default path where it looks for these notebooks is $UserBasedirectory/SystemFiles/FrontEnd/TextResources.

enter image description here

Now every time you open Mathematica, that notebook will be opened (in my case, tile.nb).

share|improve this answer
    
Now you got me curious - what is tile.nb? Suspecting some mighty init mojo ;-) –  Yves Klett Jul 14 '12 at 14:08
    
GREAT! That really puts my "vacation" mind at ease. This seems like the easiest possible solution to my remote launching needs. Thanks. –  Jagra Jul 14 '12 at 14:09
    
@YvesKlett Ha, I wish. Those are some experiments for various background tiles for this site's design. One of them was this one. I just added the first notebook that I saw to the list above for illustration purposes –  rm -rf Jul 14 '12 at 14:14
2  
@YvesKlett All that is in Hypnotoad.nb –  rm -rf Jul 14 '12 at 14:26
2  
This raises the issue as to whether the Global Preferences might be extended (by Wolfram) so as include an item AutoLoadPackages that would automatically load specified packages on kernel start. I would find using such an option far more convenient than having to edit the kernel init.m or to move packages into Autoload. –  murray Jul 14 '12 at 16:35
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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