On 28/11/2012 7:59 p.m., Liviu Andronic wrote:
On Wed, Nov 28, 2012 at 3:18 AM, Andrew Parsloe <[email protected]> wrote:
I've used the same trick (exporting to an alternatively named LyX format,
but retaining the lyx file extension) for a number of other tasks (e.g.
sorting lists, expanding abbreviations)

Quick question: Would it be a good idea to turn Track Changes on
before launching the script and modifying "built-in" the .lyx file?
This way the user can check that nothing funny happened to her file
(the parts that shouldn't have been modified), and visually check the
changes that happened to the parts that should have been modified.

Liviu

I don't think change tracking works here, since the file is modified *externally* (the built-in feel, although pleasing, is pure illusion). My solution to this problem has been to write another script which overwrites the current buffer with the backup file. This script is accessible with a further toolbar button and the buffer-reload button. If something goes wrong, recovery is two clicks away.

Since I have a number of scripts exploiting the 'trick', each requiring an alternatively named LyX format, I realised at some point that I needed a single python master script which would call the relevant sub-script to sort a table or sort a list or expand an abbreviation or do a calculation ... according to a signal in the document. That way only one alternative LyX format was needed. I've used custom insets to provide the signal. Doing things this way also means that the same toolbar buttons (or shortcuts) can be used in all cases. I'm working on a find-&-replace script (e.g. across paragraph boundaries) at the moment, and have documentation to write and no doubt will burden the list with this sometime in the weeks ahead.

Andrew

Reply via email to