Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Save vs Apple versioning (?) problem 
Author Message

Joined: 2007-03-28 07:30:34
Posts: 139
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?


2015-03-18 07:34:57
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
I don't know why that dialog is appearing. Now that Nisus Writer Pro adopts OSX document versioning, all changes should be saved to open documents without interruption.

I tried to trigger the problem you describe with a simple macro:
Code:
Select Document End
Insert Text "\nAppended."
Save

If I run that on any of a variety of open documents, I am not met with any kind of dialog when I close the document window. Is there anything unusual about your documents or your macros?


2015-03-18 14:55:01
Profile WWW

Joined: 2007-03-28 07:30:34
Posts: 139
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...


2015-03-19 09:08:39
Profile

Joined: 2007-03-28 07:30:34
Posts: 139
I just noticed that after the Save beep, " - Edited" is quickly appended to the filename at the top of the document window grayed out.

Save is the last statement in the macro. The file is definitely saved.


2015-03-19 09:32:03
Profile

Joined: 2007-03-28 07:30:34
Posts: 139
Should also note that the grayed-out "- Edited" does not appear when other macros that Save a non-glossary (rtf) document end. This only happens with glossary files.


2015-03-19 11:27:43
Profile

Joined: 2007-03-28 07:30:34
Posts: 139
Further observation suggests there is a timing problem.

If I key cmd-W quickly enough after hearing the beep, the file closes silently before "- Edited" has a chance to appear. No prompt to save changes.

If I wait a second or so, Edited appears, resulting in the described problem.

So something that should or should not happen seems to happen in this brief period btw Save executing and control returning to the open (glossary) document.


2015-03-19 11:59:37
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Thanks for the additional information, but I still haven't been able to reproduce the problem. Here's what I tried:

1. I opened an existing glossary file of mine.
2. I ran a slightly modified version of the macro snippet you shared:
Code:
$pasteText = “Hello!”
Select All
Select End
Type Text $pasteText
Glossary Entry Break
Save

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.


2015-03-19 21:06:45
Profile WWW

Joined: 2007-03-28 07:30:34
Posts: 139
Thank you for confirming that you also get the -Edited appearing.

I tried your test, and still get the prompt to save the already-saved changes.

Curiouser and curiouser...

Don't know if it matters, but am running osx 10.9.5 on a Macbook Pro.


2015-03-20 07:57:36
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
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.


2015-03-20 14:56:35
Profile WWW

Joined: 2014-02-08 12:57:03
Posts: 170
Location: Australia
G’day, all

More on the subject of the grey " — Edited" suffix in the Toolbar….

I have an AppleScript script that:–

(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.

Cheers,
Adrian

_________________
MacBook Pro (mid-2014)
macOS Sierra 10.12.6
Nisus Writer user since 1996


2015-03-22 18:35:42
Profile

Joined: 2007-03-28 07:30:34
Posts: 139
[quote]"Ask to keep changes when closing documents"[/quote]

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.


2015-03-23 07:40:31
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Hello Adrian,
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!

Quote:
(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.


2015-03-25 17:42:17
Profile WWW
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
We have a new Pro 2.1.1 beta 2 that should fix these AppleScript issues.

credneb: the new beta should also fix the problems you had with the Save command not fully clearing the document's edited state.


2015-03-27 12:06:20
Profile WWW

Joined: 2014-02-08 12:57:03
Posts: 170
Location: Australia
G’day, Martin et al

NWP 2.1.1 beta 2 does indeed fix the issues I had with AppleScript's calling (via “Do Menu Macro” commands) Nisus macros that include paragraph spacing and a Save command.

Thanks, Martin.

Cheers,
Adrian

_________________
MacBook Pro (mid-2014)
macOS Sierra 10.12.6
Nisus Writer user since 1996


2015-03-28 00:54:39
Profile

Joined: 2007-03-28 07:30:34
Posts: 139
[quote]he new beta should also fix the problems you had with the Save command not fully clearing the document's edited state.

[/quote]

Alas, it does not. the behavior remains the same.

Downloaded and unzipped the beta. Installed by simply dragging it to the applications folder. Any other installation steps required?

Cliff


2015-03-30 08:42:56
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 19 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software