After using a macro to save a change to a file that I have open in my Writer, I want writer to reload the saved file.
How do I do that?
After using a macro to save a change to a file that I have open in my Writer, I want writer to reload the saved file.
How do I do that?
I don’t understand, if you save the change, this is your last version, you don’t need to load it again.
Here is the code.
It takes the current state of the document (as seen on screen) and saves it to the underlying file. That’s exactly what I want.
The problem is that the GUI window believes its view is not saved. So I want to reload the file so that Writer knows it’s up to date.
This is in support of an autosave function. Now please do not give me a lecture about how I don’t want to do that, that LO has autorecovery which is all an intelligent person needs. Please just humor this stupid person.
How do I ‘reload’ or refresh the document view.
Please forgive my impatience, I’ve been round and round and round on this missing autosave feature.
doc = XSCRIPTCONTEXT.getDocument()
args=()
doc.storeToURL(doc.getURL(),args)
doc.setModified(False)
Might want to look at → Suggeston for Location of Backup Files - #12 by Ratslinger
.
The code is all basic but should be able to convert if wanted.
Thank you.
This resets the icons in the GUI window but if I press Ctl-S to manually save the document, I am prompted to overwrite changes made externally.
Is there someway of notifying whatever state that prompt is consulting?
Could you please be more specific on what This
actually is and who you are responding to?
This resets the icons in the GUI window but if I press Ctl-S to manually save the document, I am prompted to overwrite changes made externally.
Is there someway of notifying whatever state that prompt is consulting?
Ah sorry. I was responding to Villeroy’s suggestion.
I had clicked ‘reply’ and assumed that the intended recipient would be clear. I’m not adjusted to this new format.
I can not reproduce your issue at all.
When I save a document (no matter how), the save icon changes.
When I edit content (no matter how) the save icon changes again indicating that the document is “dirty” (unsaved).
Yes that’s my experience too. The icons change. But if I press Ctl-S (to manually save the document) the application warns me that I will be overwriting changes to the file.
That’s not a show-stopper. If I confirm the overwrite then the save proceeds as expected without altering the underlying file.
So that prompt is looking at some state or property that is not affected by the setModified method. I’m wondering what that test is.
So – yes. The setModified does reset the icons and all the other GUI indicators (‘save-all’) for example is disabled as expected.
Thank you. This makes the code much cleaner. We don’t need the ‘setModified’ call, however I’m still prompted at Ctl-S