4

How to "save as" a notebook programmatically (from within the notebook), given a path string?

here is a path string (it specifies the new name and location of the new notebook)

path="/home/conor/myNewNoteBook.nb"

I have tried many commands but none seem to work. I reckon it is something similar to this.

FrontEndExecute[
    FrontEndToken[FrontEnd`InputNotebook[], {path, "Notebook"}]
 ]

Unfortunately this similar question's solution doesn't work for me. (Maybe its because I'm using linux?)

Conor
  • 7,449
  • 1
  • 22
  • 46
  • 2
    Unless you just want to save the notebook to a different location, in which case NotebookSave is your function. – b3m2a1 Jul 16 '18 at 17:54

1 Answers1

4

Expanding b3m2a1's comment...

path = "/home/conor/myNewNoteBook.nb";
NotebookSave[EvaluationNotebook[], path]

this can be made into a function, which can be auto loaded on start up, saving the user from having to use the mouse.

Conor
  • 7,449
  • 1
  • 22
  • 46
  • 1
    If this is what you need I see no reason not to accept it so the question can be tagged as satisfactorily answered – b3m2a1 Jul 16 '18 at 18:17
  • Thanks, (it won't let me tag it for 2 days). I'll tag it in 2 days time. – Conor Jul 16 '18 at 18:23