From Briac:
You can now have sub-folders in your script corresponding to different events in OmT, and the application will run the scripts in these folders each time the event occurs.
There are currently five events supported, the "application_start" event is not working because the application has already started when the scripting engine is available. Some of these events add new binding to the script.
Here is a summary of each event :
• new_word : called when a a new word is edited in the Editor window. The new word is available with "newWord".
• project_changed : called when the state of the project changes. An "eventType" object is binded and can take the following values: CLOSE, COMPILE, CREATE, LOAD, SAVE
• entry_activated : called when editing a new segment. The segment is in the "newEntry" binding.
• new_file : called when the editor switches to the next file in the project. The new filename is in the "activeFileName" binding.
• application_shutdown : called before OmT is closed
All of the folders are of course optional, but for the moment, you can't deactivate a script inside OmegaT.
You can move it elsewhere or rename it with a non-script extension to disable it though.
If there is more than one script in the folder, it will execute them all but the order is not guaranteed.
Didier
Implemented in SVN (/trunk).
Didier
New comment from Briac:
Is it possible (or would it be) for a script (e.g. the looping script) to contain a line that disables other scripts (e.g. by name or by wildcards), either entirely while that script runs or only at certain points in the script?
Sorry, it is not currently possible to disable/enable event scripts. Feel free to create an new RFE for this feature, I'll try to have a look at how it could be achieved.
Implemented in the released version 3.1.0 of OmegaT.
Didier