Numerous macros for adding to glossary files end with Save, leaving the window open.
Sometimes I will further edit the entries, but most often simply type cmd-W immediately to then close the window *without making any further changes.*
pre-2.1 this worked fine.

With v2.1, however, an irritating dialog pops up asking if I want to save the changes before closing or revert. As noted above, the changes have already been saved. There no changes to save. Clicking Save does something, but the system beep I have set to sound when Nisus saves a file does not beep. The window simply closes. Clicking Revert closes the window but does not reverse any changes because they were already saved by the macro.

Whether a bug or a feature, how can I make this superfluous dialog box not appear?

Perhaps the only thing special about the documents is they are glossary files (ngloss) in the Glossaries folder.
The macros call a separate macro to open the glossary to edit, then does a bit of text manipulation, and then ends with

Select All
Select End
Type Text $pasteText
Glossary Entry Break

Save

At this point there's a beep (indicating to me that the file was saved) and the glossary file is still open. typing cmd-W at this point gets the save prompt (the same one you get when closing a file with changes that have not been saved).

Perhaps because it's a ngloss file? Shouldn't think that would matter, but...

3. The glossary document was modified and "— Edited" show in the document titlebar.
4. I closed the document, but no confirmation dialog appeared.

The appearance of "— Edited" is strange, and seems like a bug, since your macro instructs the document to be saved. I'll look into that. But I still don't know why you're seeing the prompt to confirm or discard your changes.

Ah, I may have found the cause: in your system preferences, in the General area, there exists an option "Ask to keep changes when closing documents". It seems that if this option is checkmarked, I can reproduce the behavior you are seeing.

Which behavior is correct is a little bit confusing here:
1. Since your macro's final command is "Save", you should never be prompted when closing the document after the macro finishes. That's a bug.
2. Assuming your macro did not include any "Save" commands, the prompt to keep or discard changes is correct, since this system option is checkmarked.
3. If this system option is checkmarked it should apply to all documents in NWP, not just glossaries. We'll have to investigate the difference in behavior.

I hope that helps for now. Thank you for bringing this to our attention.

(1) gets data from a Mail message
(2) uses the Finder to open an RTF destination file (which opens in Nisus Writer Pro); it contains the dummy text “XXXX” followed by a paragraph return
(3) gets Nisus Writer Pro to create a temporary workfile
(4) manipulates the Mail message data in the workfile via a NWP macro called by a Do Menu Macro command; this macro does not make any calls to AppleScript
(5) copies the contents of the workfile to the Clipboard
(6) closes the workfile without saving it.

The NWP macro runs with no problem. The whole AppleScript script runs with no problem.
This whole process leaves me with an open NWP document to which I now wish to append the contents of the Clipboard, separating them from any existing document text with two paragraph returns.

OK, so now I have a simple Nisus macro ("My_macro"):–

Select Document End
Type Newline
Type Newline
Paste
# If this was the first message in the document, remove the initial dummy text
Find and Replace @Text<XXXX\n\n\n>, "", 'Ea’
Save

Consider some scenarios:–

(A) If this Nisus macro is called by a Do Menu Macro command as the final command in the aforementioned AppleScript script, Nisus Writer Pro hangs indefinitely with the spinning beach ball, necessitating Force Quit.
(B) Now comment-out the Save command in the macro and run the AppleScript script which again calls the macro by a Do Menu Macro command. Now Nisus Writer Pro does not hang, but the Statusbar says: Running macro "My_macro". Filename at top of Toolbar has grey " — Edited" suffix appended. This situation persists indefinitely.
(C) Next, forget about the AppleScript script, ensure there is something in the Clipboard and run the macro directly on a simple Nisus document. Everything works as it should, with the grey " — Edited" suffix visible. The suffix automatically disappears after about 15 seconds.
(D) Finally, reinstate the Save command in the Nisus macro, ensure there is something in the Clipboard and again run the macro directly on a simple Nisus document. Everything works as it should, with the grey " — Edited" suffix appearing briefly, then disappearing. However, the grey " — Edited" suffix immediately reappears and then takes about 15 seconds to disappear finally.

To my mind, only Scenario C is without problem, assuming its 15-second delay is a properly functioning part of some autosave process.
BTW In System Preferences > General, "Ask to keep changes when closing documents" is unchecked.

Aha. Un/checking this option reproduces the behavior you describe. Note regular rtf documents affected by macros that end in Save are _not_ similarly affected. Only glossaries.

While you search for the solution, perhaps part of the problem is some timing issue as I previously wrote about, i.e., typing cmd-W quickly enough after the macro Save executes does not get the save/revert prompt.

Thanks for your help tracking this down. Until a solution comes along, I guess I will live with the prompt.

adryan wrote:(A) If this Nisus macro is called by a Do Menu Macro command as the final command in the aforementioned AppleScript script, Nisus Writer Pro hangs indefinitely with the spinning beach ball, necessitating Force Quit.
(B) Now comment-out the Save command in the macro and run the AppleScript script which again calls the macro by a Do Menu Macro command. Now Nisus Writer Pro does not hang, but the Statusbar says: Running macro "My_macro". Filename at top of Toolbar has grey " — Edited" suffix appended. This situation persists indefinitely.

These scenarios are particularly bad. Could you share your AppleScript with me for testing? You could attach it here on the forum, or send it to me privately via the menu Help > Send Feedback. Thanks!

(C) Next, forget about the AppleScript script, ensure there is something in the Clipboard and run the macro directly on a simple Nisus document. Everything works as it should, with the grey " — Edited" suffix visible. The suffix automatically disappears after about 15 seconds.
(D) Finally, reinstate the Save command in the Nisus macro, ensure there is something in the Clipboard and again run the macro directly on a simple Nisus document. Everything works as it should, with the grey " — Edited" suffix appearing briefly, then disappearing. However, the grey " — Edited" suffix immediately reappears and then takes about 15 seconds to disappear finally.

I'll also have to check these scenarios. It may just be that the "— Edited" suffix is lingering longer than it should, or could indicate a problem with the macro Save command.