I want to save a copy of the current notebook using Mathematica code
(* the notebook that's open is foo.nb *)
NotebookSave[SelectedNotebook[], "bar.nb"]
After execution, Mathematica would close foo.nb
without saving, and open bar.nb
. If I saved the path of foo.nb
, close bar.nb
, and reopen foo.nb
, I would jump to the beginning of the file instead of having my cursor position saved.
How can I save a copy of foo.nb
as bar.nb
in the background, while still retaining my focus on foo.nb
?