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

@mark_t sorry for delay. Checked 3 times earlier. Check again, changed 2 more times. Finally got it correct. Code works with reasonable testing in xubuntu 16.04 (64-bit) and Mint(Cinnamon) 17.3 (64-bit) both using LO v5.2. Unfortunately, OpenOffice 4.0.1 didn’t work. However, it did work with my code. Giving me an error for the ‘save’ directory. Will look more. Speaking of - in your document you fail to reference the change necessary for the directory in which to save the backups.

I also just checked in Virtual Box, linuxmint-18-cinnamon-64bit, default LibreOffice 5.1.2.2, which uses “/usr/lib/libreoffice/program/soffice.bin”. Is there a better way to specify the path that will always work? If not then do you know what the best default would be?

I have “/usr/lib/libreoffice/program/” but no soffice.bin there for LO v5.2.0.4, and nothing under “/user/lib” for OpenOffice. Both of these fall under “/opt” as “libreoffice5.2” and “openoffice4”. May be better as “/opt/libreoffice5.2/program/soffice.bin” for default. I just wasn’t paying enough attention. It’s even there but commented out. Can’t see forest through trees today.

I found we don’t need the path, just use “soffice” same as windows. At least this works on linuxmint-18-cinnamon-64bit.

Just remembered - don’t see check for Base in new code. Quick check - soffice didn’t work.

I’ll check and make sure to include it. I have another error to fix, if Basic IDE is open but the document has been closed it thows an error, need to check the URL property exists.

Updated attached document to v1.1 to fix the issues in recent comments.

Just checked v1.2 on xubuntu. /opt/libreoffice5.2/program/soffice works; soffice doesn’t. Edit: Just added Openoffice v4.0.1 to xubuntu (was on Mint only before). Your v1.2 now works OK. However, use of soffice doesn’t. It kind of makes sense - both LO and AOO have an soffice.

If you try and run just soffice from a command window then it doesn’t work unless you change directory to the program folder. When you run from the Shell command then LibreOffice and OpenOffice both set the working directory to their own program folder, so the macro should work on both with only soffice in the shell command.

soffice from Shell does not work (on both LO & AOO) unless I put the full path into the macro. The initial Bash command starts and once the timer completes the cycle ends. Put the full path back in and it all works fine. Edit: Just now downloaded your document to make sure I wasn’t using wrong code. Same results.

Strange, I just tried again in Virtual box and I just type soffice from console and it runs LibreOffice. I might have set execute permission on soffice. Is there an equivalent of environment settings for paths to search for executables. Long time since I spent much time on Unix.

After some investigating here is what is. soffice DOES work in AOO but not LO (another error by me probably). As from the terminal, soffice is a shell script in /usr/bin which then resolves the installation directory (and a few other things). soffice is for AOO and starts it from the terminal. The equivalent for LO is “libreoffice5.2” and that works in the macro and from the terminal. But that still means that depending upon the LO version as to which command to use. Is that clear?

This makes sense that when soffice was used in LO, nothing was running in AOO so the cycle ended.

Saw you post and response. This works for LO but not for AOO (slightly different return). Of note - '$(inst)' SB "$(inst)" and I’m sure you realize you must strip characters from the return string.

I think I have it working for both LO and AOO using $(prog) in Virtual Box on linux mint. I’ll test on windows and then post the update.

Did quick test on Xubuntu and LO and AOO work well. Good work.

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.

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

@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).

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.