A quick and easy intro to OmegaT scripts:
- OmegaT comes bundled with several scripts. Some of them are of little practical use as they are included as examples for users willing to write their own scripts.
- The bundled scripts are located in
scriptssubfolder of the folder where OmegaT is installed. Often the installation is done in a location where a regular user doesn’t have write permissions, which means adding and removing scripts can be complicated.
- Luckily, OmegaT permits setting an arbitrary location for scripts. Do that! It can be any location where you can write to. It doesn’t matter if it contains no scripts at the moment: you can add only the ones you need, and only as you need them.
It makes sense to place the scripts folder into the OmegaT config folder (the folder where OmegaT stores its settings) just for convenience.
But it can, of course, be any other folder.
- Copy the scripts you need to the folder that was set for scripts.
If you’re downloading from GitHub, you might need to show the desired script in raw format, and then save the page. If it saves as
filename.groovy.txt, just remove the
.txtpart. If the file got saved in your
Downloadsfolder, just move it into the folder set for your scripts.
- In OmegaT, open Tools → Scripting, in the newly open Scripting window select the script you need (left part of the window) and hit Run (lower left corner).
- If you need to run a script quite often, there is a way to assign shortcuts to up to 12 scripts:
Select the script you want to run with a shortcut
Right-click on one of the 12 buttons in the lower part of the Scripting window
Select “Add Script”
- The script thus installed is available under Tools, or can be run by pressing Control+Shift+Fn (Fn is a function key at the top of the keyboard, n is a number between 1 and 12, and the number on the button in the Scripting window corresponds to the number on the function key)