First you must get the notebooks that need saving:
nbs=Select[Notebooks[], (StringMatchQ[
"WindowTitle" /. NotebookInformation[#], "Untitled*"]) &]
Further, we need the name of the notebook:
"WindowTitle" /.NotebookInformation[...];
Then we need to remember the current notebook:
cnb = SelectedNotebook[];
With these commands we can save all "Untitled" notebook to the $TemporaryDirectory:
cnb = SelectedNotebook[];
nbs = Select[
Notebooks[], (StringMatchQ["WindowTitle" /. NotebookInformation[#],
"Untitled*"]) &];
NotebookSave[#,
FileNameJoin[{$TemporaryDirectory, "WindowTitle"} /.
NotebookInformation[#]]] & /@ nbs;
SetSelectedNotebook[cnb];
To execute the above commands say every minute, we put them inside a Dynamic with an update interval of 60 sec:
Dynamic[
cnb = SelectedNotebook[];
nbs = Select[
Notebooks[], (StringMatchQ["WindowTitle" /. NotebookInformation[#],
"Untitled*"]) &];
NotebookSave[#,
FileNameJoin[{$TemporaryDirectory, "WindowTitle"} /.
NotebookInformation[#]]] & /@ nbs;
SetSelectedNotebook[cnb];
, UpdateInterval -> 60]