If I manually open a new DocumentNotebook in the front end using the GUI, and then I put input in the document, and then try to close the document, I get a safety dialog asking me whether I want to save the document:
If I create a new DocumentNotebook using the CreateNotebook
symbol, put something into it, however, I can close the notebook and I don't get the safety dialog. I want to force such automatically created notebooks to have a safety dialog.
At first blush, it looks like the contents I'm inserting into the created notebook are not inputs (no In[47]:=
notation on the left). So perhaps a better question is "How can I automatically insert input into an automatically created notebook?" The key, here, is "automatically;" I want to do this without any manual interaction with the front-end GUI.