Ask Your Question
1

[LibO 5.1.5 on debian 8.5] writer close without asking to save, in need of an AUTOMATIC Incremental saving function

asked 2016-08-20 12:53:15 +0200

evanescente_ondine gravatar image

Hello. Yesterday, I, by mistake, click on the "cross" button, lost a day worth of work ! I clicked on the cross button by mistake, but usually I don't care, as LibO has always asked me to save my work. What wasn't my surprise, when the window just shut up ! A whole day worth of work was lost. I would NOT have clicked on "do not save", absolutely not. The auto-saves functon is put to 15 minutes, but the last "bak" file I could find was from this morning. How can it be ? I installed an add-on to do incremental save. But I don't know how to make it automatic. I never think about saving my work till the end of the day, and I won't begin, as it's not my job. I would like my work to be saved by LibO each 15 minutes, with the version name each time a little different, with hour and minutes, in order for them no to erase one another.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
1

answered 2016-08-21 23:07:24 +0200

floris v gravatar image

I never think about saving my work till the end of the day, and I won't begin, as it's not my job.

Sorry, but it is your job. When I took computer classes, back in the eighties, we were told that we were to save our work every fifteen minutes or so, to keep loss of work as a result of a power cut or computer crashes to an acceptable minimum. Until there's an inbuilt way to auto-save your work every 15 minutes, it's up to you.

edit flag offensive delete link more
1

answered 2016-08-21 21:05:47 +0200

mark_t gravatar image

updated 2016-08-29 18:24:12 +0200

Similar question has been asked before.

LibreOffice not autosaving documents

WHY NOT AUTOSAVE ?

The latter links to this OpenOffice forum post that has a macro you might find usefull.

[Basic] Save a document and create a timestamped copy

Updated attached to v1.2. TimedAutoBackup.odt

v1.2 should now also work for OpenOffice.

Updated to v1.3. TimedAutoBackup.odt

Finds path for soffice on linux using "$(prog)" from "com.sun.star.util.PathSubstitution". Thanks to @karolus for answer to find-install-directory-of-libreoffice-on-linux

edit flag offensive delete link more

Comments

@mark_t see your change. Will try in Linux. Also might it not be better if the three subs were placed in three separate text files and attached to you answer. Then you can indicate with note the "last modified" date/note.

Ratslinger gravatar imageRatslinger ( 2016-08-22 18:36:16 +0200 )edit

Linux won't work this way. Can't pass parameter in this manner. Problems with "(" in command. Not sure if there is another way. Can do everything else but parameter. Will try to see if another way. At least script is working.

Ratslinger gravatar imageRatslinger ( 2016-08-22 21:10:43 +0200 )edit

Modified to put extra quotes to avoid problem with "(". ""macro:///Standard.Autosave.TimedAutomaticBackup(" & oDoc.URL & ")""" Tested on windows and in virtual box on linux mint.

mark_t gravatar imagemark_t ( 2016-08-23 05:28:11 +0200 )edit

Tried on xubuntu 16.04 and it did not work. Even tried commenting out GUI check. Tried on Mint 17.3 and it works to a point. One document open all is OK. Open second document and make a change to second, saves first and nothing for second. First document didn't even have changes. With shell script a it saved better. Also, this is only for Writer.

Ratslinger gravatar imageRatslinger ( 2016-08-23 06:50:26 +0200 )edit

Again on Mint. Get different results when starting multiple docs. When up for a time, all seems OK.

Ratslinger gravatar imageRatslinger ( 2016-08-23 07:05:05 +0200 )edit

Back to xubuntu. Copied macros from Mint and all worked OK. Even multi Writer docs seems OK. Must have had keyed something in wrong. Good work.

Ratslinger gravatar imageRatslinger ( 2016-08-23 07:27:48 +0200 )edit

Hello. Tested with Calc/Writer - no apparent problems. There is a problem with Base. This is not a supported type (and it shouldn't be for many reasons) but it still tries to go through the process & clears the isModified flag - big problem. Also causes other problems. The following statement inserted into TriggerAutomaticBackup just after getting oDoc seems to work:

If oDoc.supportsService("com.sun.star.sdb.OfficeDatabaseDocument") Then Exit Sub

Ratslinger gravatar imageRatslinger ( 2016-08-23 16:02:20 +0200 )edit

Thanks @Ratslinger, added your change to the code block.

mark_t gravatar imagemark_t ( 2016-08-23 16:39:33 +0200 )edit

@mark_t I have possible change to the triggering of the process. As it is a bit long, please see the attachment at the end of my answer. Thank you.

Ratslinger gravatar imageRatslinger ( 2016-08-26 22:28:18 +0200 )edit

One more change just tried. Remove two lines from routine - "else" and "AutomaticBackup(oDoc)". Now if document is opened but no changes, no backup is generated. Also, if user does save, no further backups until another change in the document is detected. This can save generation of many backup copies especially is just reading a document.

Ratslinger gravatar imageRatslinger ( 2016-08-26 22:57:28 +0200 )edit
0

answered 2016-08-21 21:47:57 +0200

Ratslinger gravatar image

updated 2016-08-27 17:04:20 +0200

I've been playing with this since this question arose and the last post noted by @mark_t . You can set up a timing loop.

Edit 08/22/16:

Please refer to @mark_t answer for code. I tested with xubuntu 16.04 and Mint 17.03 and seems to work without problem for Writer. Above posted code remains for reference only.

Edit 8/27/16:

Old code and comments removed as they were outdated.

edit flag offensive delete link more

Comments

Also note the change I made to TimedAutomaticBackup in case the file is no longer open or if LO has been closed.

mark_t gravatar imagemark_t ( 2016-08-22 07:18:05 +0200 )edit

@mark_t thank you, got your change. Just tested in xubuntu with no problems after getting shell location correct. Only OS left is Mac or maybe some non-Ubuntu based Linux systems (most should be OK).

Ratslinger gravatar imageRatslinger ( 2016-08-22 18:22:54 +0200 )edit

If you have time could you check if an external batch file can be avoided using bash, as this seems to work ok in windows. I included what I think is the correct code in my last edit, just need to change from false to true in the if statement.

mark_t gravatar imagemark_t ( 2016-08-22 18:28:30 +0200 )edit

I know this comment is not apparent, but anyone getting to this post directly should know there is an additional function available for this process. It allows the user a choice of the number of backup copies to be retained. There is also notation on how to place each different files' backup in a separate subdirectory. Please see my answer in this post - click here.

Ratslinger gravatar imageRatslinger ( 2017-03-07 04:17:57 +0200 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2016-08-20 12:53:15 +0200

Seen: 650 times

Last updated: Aug 29 '16