Macro to abandon edits

I'm migrating a bunch of spreadsheets from Debian Lenny/Openoffice to Debian Wheezy/Libreoffice 3.5.x. This is a dedicated setup used by many once-a-year users (who aren't chosen for their familiarity with computers) and, for instance, boots straight into a front end when switched on and shuts down when you close the front end. All driven by a startup script which launches the front end and waits for it to close.

The front end is fundamentally some buttons to launch working sheets and unchanging except that today's date is filled in when it starts, or the user can enter a different date. Mass of macros to handle it all.

Closing the front end is by doc.close()ing in a Goodbye macro but this leaves an soffice.bin process running and you get a 'Program is still running' dialogue box when the machine shuts down; it goes away after a bit but it will alarm the user. I can get rid of that by putting 'stardesktop.terminate' (is 'xdesktop.terminate' preferrred?) in the shutdown macro but then when it next starts it wants to Recover the front end; that's a big no-no.

Under Lenny/Openoffice there isn't this problem, when you've doc.close()d it shuts down happily and when it's next switched on loads the front end without complaint. I've tried doc.setmodified(FALSE) but no joy. I suppose I could get the shutdown macro to save it and the startup script to then delete that and copy the master back but that's pretty horrible. Is there a sensible way to fix this?

You might have to run a logout script from some type of ".rc" file.

This is not the actual command and is not the best way to do it. It should be possible.
The script will have a
     kill -9 soffice.bin
             and will need code to find it with 'ps'.

See https://unix.stackexchange.com/questions/2745/how-to-run-a-script-during-gnome-log-out as an example from Gnome.

Hope this helps.

Hi :slight_smile:
In Debain family maybe "pkill" might be better to kill a named process
rather than by it's id? Wouldn't a "kill" (or "pkill") command also mean
the next time you open LibreOffice it'll try to recover a file?

I'm not sure about any of this so i'm just wondering. I tend to stay as
far away from the command-line as possible but occasionally find myself
doing odd things there.
Regards from
Tom :slight_smile:

http://www.oooforum.org/forum/viewtopic.phtml?t=46441

Last i checked, and that was a while ago, you could not tell LO to exit while a macro is running, but, you can probably issue a shell command to kill it from a macro.

Best of luck. It's for a club and there are 80 or so people who use it. If you had a well publicised training session you might get 15 or 20 turn up - and they'd have forgotten it all when it came to their turn to use it up to a year later.

http://www.oooforum.org/forum/viewtopic.phtml?t=46441

Last i checked, and that was a while ago, you could not tell LO to exit while a macro is running, but, you can probably issue a shell command to kill it from a macro.

'stardesktop.terminate' as the last statement in the shutdown macro seems to do the job. Feels better to me than a killall in the script after closing. I did wonder what doc.close(false) would do, it's shown everywhere as doc.close(true) but without any documentation of the parameter that I can find.