kosivantsov / omegat_scripts Goto Github PK
View Code? Open in Web Editor NEWScripts for OmegaT
License: GNU General Public License v3.0
Scripts for OmegaT
License: GNU General Public License v3.0
Preconditions
C:\Users\<user>\AppData\Roaming\OmegaT\scripts
is version:38_c00
Steps to reproduce
version_notes.txt
and local_version_notes.txt
.https://cat.capstan.be/OmegaT/dev/index.php
if requestedExpected results
config_dir
. For example, file updateConfigBundle.groovy
in C:\Users\<user>\AppData\Roaming\OmegaT\scripts
is now version 0.4.6 (2020-03-06).Actual results
The script should check if there are other instances of OmegaT using the same config folder are currently running
How to cope with large number of segments? Script returning error:
javax.script.ScriptException: javax.script.ScriptException: jxl.write.biff.RowsExceededException: The maximum number of rows permitted on a worksheet been exceeded
Run OmegaT when the customization script is in the application_startup
folder or run the customization script manually.
The script downloads the jar files and puts them in the plugins
folder, which is empty.
The script downloads the jar files bundle, unzips it and then says the plugins
folder in the user customization folder cannot be written to, and keeps running forever.
The console gives the error below:
========================================
Customisation Update
========================================
Fresh customisation bundle installation (v.53_cs0):
* Config needs to be installed.
* Scripts need to be installed.
* Plugins needs to be updated.
----------------------------------------
config.zip is being downloaded...
config.zip is being unpacked...
Customisation is being updated...
OmegaT will need to be restarted.
-- Done --
----------------------------------------
scripts.zip is being downloaded...
scripts.zip is being unpacked...
Scripts are being installed...
Scripts provided
in the customisation bundle
copied to
/Users/pico/Library/Preferences/OmegaT/scripts.
-- Done --
----------------------------------------
plugins.zip is being downloaded...
plugins.zip is being unpacked...
Plugins are being installed...
An error occurred
javax.script.ScriptException: javax.script.ScriptException: java.io.IOException: Destination '/Users/pico/Library/Preferences/OmegaT/plugins' cannot be written to
Pre-conditions
A version n of a plugin is in the local installation and a version n+1 is available for download. Accordintly, the remote version_notes.txt
has +1 version than the local version. E.g.
Latest version in local version_notes.txt
is:
## Update 51_c0p (2020-07-01)
* Blabla.
Local plugins
folder has:
Latest version in remote version_notes.txt
is :
## Update 52_c0p (2020-07-03)
* Plugin `plugin-omt-package-1.6.1.jar` available (same name, new functionality).
Expected results
After the update, the plugins
folder has (among others):
Actual results
After the update, the plugins
folder has (among others):
The script runs well on the GUI (tested with version 4.3.2) but on the command line (on a linux server) there are some errors.
This is the line I use:
java -jar /opt/omegat/OmegaT_4.3.2_Linux_64/OmegaT.jar projectDir --script=/opt/omegat/scripts/write_table_for_TMX_alt.groovy --mode=console-translate
This is my java:
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
And these are the errors that I get:
19551: Info: Project loading end (LOG_DATAENGINE_LOAD_END)
19551: Info: Executing script /opt/omegat/scripts/write_table_for_TMX_alt.groovy (event LOAD)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/opt/omegat/OmegaT_4.3.2_Linux_64/lib/groovy-2.5.6.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
19551: Error: javax.script.ScriptException: javax.script.ScriptException: java.lang.NullPointerException: Cannot invoke method getCurrentFile() on null object
19551: Error: at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158)
19551: Error: at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
19551: Error: at org.omegat.gui.scripting.ScriptRunner.executeScript(ScriptRunner.java:169)
19551: Error: at org.omegat.gui.scripting.ScriptRunner.executeScript(ScriptRunner.java:133)
19551: Error: at org.omegat.gui.scripting.ScriptRunner.executeScript(ScriptRunner.java:85)
19551: Error: at org.omegat.Main.executeConsoleScript(Main.java:552)
19551: Error: at org.omegat.Main.selectProjectConsoleMode(Main.java:526)
19551: Error: at org.omegat.Main.runConsoleTranslate(Main.java:335)
19551: Error: at org.omegat.Main.main(Main.java:187)
19551: Error: Caused by: javax.script.ScriptException: java.lang.NullPointerException: Cannot invoke method getCurrentFile() on null object
19551: Error: at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320)
19551: Error: at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155)
19551: Error: ... 8 more
19551: Error: Caused by: java.lang.NullPointerException: Cannot invoke method getCurrentFile() on null object
19551: Error: at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)
19551: Error: at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:43)
19551: Error: at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
19551: Error: at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:34)
19551: Error: at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
19551: Error: at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
19551: Error: at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
19551: Error: at Script1.run(Script1.groovy:94)
19551: Error: at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)
19551: Error: ... 9 more
Translating Project
19551: Info: Project compiling start (LOG_DATAENGINE_COMPILE_START)
Creating translated documents: ft2ms_alt-trans_test.docx
Translated document created
19551: Info: Project compiling end (LOG_DATAENGINE_COMPILE_END)
19551: Info: Executing script /opt/omegat/scripts/write_table_for_TMX_alt.groovy (event COMPILE)
19551: Info: Event: project change - "COMPILE" (LOG_INFO_EVENT_PROJECT_CHANGE)
19551: Error: javax.script.ScriptException: javax.script.ScriptException: java.lang.NullPointerException: Cannot invoke method getCurrentFile() on null object
19551: Error: at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158)
19551: Error: at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
19551: Error: at org.omegat.gui.scripting.ScriptRunner.executeScript(ScriptRunner.java:169)
19551: Error: at org.omegat.gui.scripting.ScriptRunner.executeScript(ScriptRunner.java:133)
19551: Error: at org.omegat.gui.scripting.ScriptRunner.executeScript(ScriptRunner.java:85)
19551: Error: at org.omegat.Main.executeConsoleScript(Main.java:552)
19551: Error: at org.omegat.Main.runConsoleTranslate(Main.java:350)
19551: Error: at org.omegat.Main.main(Main.java:187)
19551: Error: Caused by: javax.script.ScriptException: java.lang.NullPointerException: Cannot invoke method getCurrentFile() on null object
19551: Error: at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320)
19551: Error: at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155)
19551: Error: ... 7 more
19551: Error: Caused by: java.lang.NullPointerException: Cannot invoke method getCurrentFile() on null object
19551: Error: at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)
19551: Error: at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:43)
19551: Error: at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
19551: Error: at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:34)
19551: Error: at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
19551: Error: at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
19551: Error: at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
19551: Error: at Script2.run(Script2.groovy:94)
19551: Error: at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)
19551: Error: ... 8 more
19551: Info: Project closed (LOG_DATAENGINE_CLOSE)
19551: Info: Executing script /opt/omegat/scripts/write_table_for_TMX_alt.groovy (event CLOSE)
19551: Error: javax.script.ScriptException: javax.script.ScriptException: java.lang.NullPointerException: Cannot invoke method getCurrentFile() on null object
19551: Error: at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158)
19551: Error: at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
19551: Error: at org.omegat.gui.scripting.ScriptRunner.executeScript(ScriptRunner.java:169)
19551: Error: at org.omegat.gui.scripting.ScriptRunner.executeScript(ScriptRunner.java:133)
19551: Error: at org.omegat.gui.scripting.ScriptRunner.executeScript(ScriptRunner.java:85)
19551: Error: at org.omegat.Main.executeConsoleScript(Main.java:552)
19551: Error: at org.omegat.Main.runConsoleTranslate(Main.java:353)
19551: Error: at org.omegat.Main.main(Main.java:187)
19551: Error: Caused by: javax.script.ScriptException: java.lang.NullPointerException: Cannot invoke method getCurrentFile() on null object
19551: Error: at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320)
19551: Error: at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155)
19551: Error: ... 7 more
19551: Error: Caused by: java.lang.NullPointerException: Cannot invoke method getCurrentFile() on null object
19551: Error: at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)
19551: Error: at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:43)
19551: Error: at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
19551: Error: at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:34)
19551: Error: at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
19551: Error: at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
19551: Error: at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
19551: Error: at Script3.run(Script3.groovy:94)
19551: Error: at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)
19551: Error: ... 8 more
Finished
Let me know if any more info can be useful.
Thank you, Kos.
OmegaT 4.x.x installed in a machine running Windows 10.
Script application_startup\updateConfigBundle.groovy
is version 0.4.9 and def customUrl = ""
File customisation.properties
has url: https://cat.capstan.be/OmegaT/dev2021_049/index.php
Local customization version 57_cs0 (2020-11-25)
Remote customization version 58_c0p (2020-11-26)
Local plugins:
Remote plugins:
Just launch OmegaT.
The script runs and sees that okapiFiltersForOmegaT-1.8-1.40.0-capstan.jar
is a new version of okapiFiltersForOmegaT-1.6-m40-capstan.jar
, so the former must replace the latter.
The new version is downloaded and, after OmegaT shuts down, the old version of the plugin is deleted (by means of the bat file triggered by the script).
The progress bar dialog runs forever and the script fails with error javax.script.ScriptException: javax.script.ScriptException: org.apache.commons.io.FileExistsException: Destination 'C:\Users\souto\AppData\Roaming\OmegaT\plugins\omegat-bidimarkers-0.2.0-all.jar' already exists
.
See full console output:
========================================
Customisation Update
========================================
Local customisation version is 51_c0p.
Remote customisation version is 53_cs0.
Customisation update available:
* Config needs to be updated.
* Scripts need to be updated.
* Plugins need to be updated.
----------------------------------------
config.zip is being downloaded...
config.zip is being unpacked...
Customisation is being updated...
OmegaT will need to be restarted.
-- Done --
----------------------------------------
scripts.zip is being downloaded...
scripts.zip is being unpacked...
Scripts are being installed...
Scripts provided
in the customisation bundle
copied to
C:\Users\souto\AppData\Roaming\OmegaT\scripts.
-- Done --
----------------------------------------
plugins.zip is being downloaded...
plugins.zip is being unpacked...
Plugins are being installed...
--
Folder
C:\Program Files\OmegaT\plugins
is not writable, but it contains file(s)
which should be updated by this
customisation update utility:
C:\Program Files\OmegaT\plugins\plugin-omt-package-1.6.3.jar
C:\Program Files\OmegaT\plugins\plugin-omt-package-1.6.3.jar
Make sure the listed files are deleted
before you start OmegaT again.
The newer versions of these files
will be installed
into user's configuration folder.
--
An error occurred
javax.script.ScriptException: javax.script.ScriptException: org.apache.commons.io.FileExistsException: Destination 'C:\Users\souto\AppData\Roaming\OmegaT\plugins\omegat-bidimarkers-0.2.0-all.jar' already exists
Reproduced in my machine. Other users haver reported same behaviour (customizer runs forever), although I couldn't see whether they had the same error.
The only way to stop that is to close the progress bar dialog, which closes OmegaT. The version_notes.txt
is updated/overwritten, whereas the local_version_notes.txt
remains unaltered.
Preconditions
Some scripts are edited and have a mark like ##OLD##
Some plugins have old versions (e.g. okapi: 1.5)
Latest script version is saved outside of the scripts
folder:
Available customization version is 38_c00
Current version in version_notes.txt
and local_version_notes.txt
is 36_c00
Steps to reproduce
https://cat.capstan.be/OmegaT/dev/index.php
if requested)Expected results
Since there current version is not contiguous to the latest version available (38 - 36 > 1), all config files, scripts and plugins are downloaded and written in config_dir
. For example, after the update,
##OLD##
is restored (and that edit is removed) andActual results
Plugins are updated but scripts are not.
Hi Kos!
Thank you very much for your very excellent scripts!
In respect to the issue at hand, I'm referring to the Merge or split segments script, which I am having a trouble executing as of late with the system specs mentioned below.
I very much hope that it would not be much trouble for you to update the script to be able to run on the cutting edge versions of OmegaT 6.0.1 and 6.1.0.
I've been using the script on OmegaT 6.0.1 successfully for some time now, but not with the most recent build. Though, on OmegaT 6.1.0 the script never worked for me.
Or perhaps could it be that I'm using the most recent Java version?.. I don't know. But until this issue I was using jdk-17.0.8+7 LTS via adoptium.net
Anyway, my system specs are as follows:
macOS Ventura 13.5.1
Java:
openjdk version "20.0.2" 2023-07-18
OpenJDK Runtime Environment Temurin-20.0.2+9 (build 20.0.2+9)
OpenJDK 64-Bit Server VM Temurin-20.0.2+9 (build 20.0.2+9, mixed mode)
OmegaT:
v6.0.1 2023-08-19 build without JRE
https://sourceforge.net/projects/omegat/files/Weekly/OmegaT_6.0.1_Without_JRE.zip/download
And the error that is being reported by OmegaT when executing the script is:
The script "merge_split.groovy" is running...
An error occurred
BUG! exception in phase 'semantic analysis' in source unit 'Script2.groovy' Unsupported class file major version 64
Thank you very much for looking into this.
Preconditions
C:\Program Files\OmegaT\plugins
contains some jar files:updateConfigBundle.groovy
is the latest versionInstalled customization version is lower than available version at https://cat.capstan.be/OmegaT/dev/index.php
File customisation.properties
has URL https://cat.capstan.be/OmegaT/dev/index.php
Steps to reproduce
updateConfigBundle.groovy
script.Expected results
The script deletes the jar files in folder C:\Program Files\OmegaT\plugins
if it has enough permissions or, if not, the script shows a dialog prompt at the end of the execution asking the user to delete those files manually.
Actual results
No prompt dialog and jar files in C:\Program Files\OmegaT\plugins
not deleted.
Suggestion
The above dialog could say the following:
Customization Update v. XX
====================
OmegaT will now close.
WARNING:
To avoid conflicts, please delete manually
all plugin files in C:\Programe Files\OmegaT\plugins.
[**OK**]
Pre-conditions
A version n of a plugin is in the local installation and a version n+1 is available for download. The remote version_notes.txt accordingly as +1 version than the local version. Eg.
Latest version in local version_notes.txt
is:
## Update 51_c0p (2020-07-01)
* Blabla.
Local plugins
folder has:
Latest version in remote version_notes.txt
is :
## Update 52_c0p (2020-07-03)
* Plugin `plugin-omt-package-1.6.1.jar` available.
Expected results
After the update, the plugins
folder has (among others):
Actual results
After the update, the plugins
folder has (among others):
Further info
Reproduced by some users (e.g. IL) but not others.
Current behaviour
When OmegaT needs to be closed to implement updates, the user gets this prompt:
Customization update {version} finished
OmegaT will now close
[OK]
Desired behaviour
Could we change it to the following?
Customization update {version} is available.
Please close OmegaT now to update.
[OK]
More info
I think this is similar to what you had initially, which I didn't want because I thought it could mislead user to think that they need to do something actively to restart, I thought "it will close" was clearer.
However, I had second thoughts, and probably something like what I'm suggestion is more similar to what people are used to see in other applications.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.