Git Product home page Git Product logo

omegat_scripts's People

Contributors

kosivantsov avatar msoutopico avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

omegat_scripts's Issues

Some custom files not updated if no version_notes.txt available

Preconditions

  1. Current script in C:\Users\<user>\AppData\Roaming\OmegaT\scripts is version:
  1. Latest script version is saved somewhere else:
  1. Available customization version is 38_c00

Steps to reproduce

  1. Delete files version_notes.txt and local_version_notes.txt.
  2. In OmegaT, go to Tools > Scripting > File > Open Script and select script 0.4.7 (2019-12-30), run that script.
  3. Insert https://cat.capstan.be/OmegaT/dev/index.php if requested

Expected results

  • All config files, scripts and plugins are written in 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

  • Config files seem to be downloaded but scripts are not updated.
    image

Customization -- java.io.IOException: plugins folder cannot be written to

Preconditions

  • OmegaT is installed and the plugins folder (under the user configuration folder) is empty.
  • OmegaT version is 5.3.0
  • Script version is 0.4.9
  • Running on Mac OS 10.13.6 (High Sierra)
  • Local version is 51 and remote version is 53 at least.

Steps

Run OmegaT when the customization script is in the application_startup folder or run the customization script manually.

Expected results

The script downloads the jar files and puts them in the plugins folder, which is empty.

Actual results

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

Customization - New version of plugin does not replace old version if filename is identical

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:

  • plugin-omt-package-1.6.1.jar

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):

  • (new) plugin-omt-package-1.6.1.jar

Actual results

After the update, the plugins folder has (among others):

  • (old) plugin-omt-package-1.6.1.jar

Errors running script `write_table_for_TMX_alt.groovy` on the command line

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.

Customizer runs forever with error that destination file exists

Preconditions

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:

  • okapiFiltersForOmegaT-1.6-m40-capstan.jar
  • omegat-bidimarkers-0.2.0-all.jar
  • plugin-omt-package-1.6.3.jar

Remote plugins:

  • okapiFiltersForOmegaT-1.8-1.40.0-capstan.jar (NEW)
  • omegat-bidimarkers-0.2.0-all.jar
  • plugin-omt-package-1.6.3.jar

Steps to reproduce

Just launch OmegaT.

Expected results

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).

Actual results

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.

Scripts not updated when customization is two versions old

Preconditions

  1. Some scripts are edited and have a mark like ##OLD##

  2. Some plugins have old versions (e.g. okapi: 1.5)

  3. Latest script version is saved outside of the scripts folder:

  1. Available customization version is 38_c00

  2. Current version in version_notes.txt and local_version_notes.txt is 36_c00

Steps to reproduce

  1. In OmegaT, go to Tools > Scripting > File > Open Script and select script 0.4.7 (2019-12-30), run that script.
    (2. Insert 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,

  • file script with ##OLD## is restored (and that edit is removed) and
  • the old version of the plugin is replaced with the new version

Actual results
Plugins are updated but scripts are not.

image

exception in phase 'semantic analysis' in source unit 'Script2.groovy'

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.

No prompt about jar files in install_dir/plugins not deleted

Preconditions

  1. Folder C:\Program Files\OmegaT\plugins contains some jar files:
  • okapiFiltersForOmegaT-1.6-m36-capstan.jar
  • plugin-omt-package-1.4.1.jar
  1. Installed script updateConfigBundle.groovy is the latest version
  1. Installed customization version is lower than available version at https://cat.capstan.be/OmegaT/dev/index.php

  2. File customisation.properties has URL https://cat.capstan.be/OmegaT/dev/index.php

Steps to reproduce

  1. Run 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.
image

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**]         
              

Customization update does not delete old plugins

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:

  • plugin-omt-package-1.6.0.jar

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):

  • plugin-omt-package-1.6.1.jar

Actual results

After the update, the plugins folder has (among others):

  • plugin-omt-package-1.6.0.jar
  • plugin-omt-package-1.6.1.jar

image_2020_07_03T14_20_04_175Z

Further info

Reproduced by some users (e.g. IL) but not others.

Cosmetic change to restarting message

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]

image

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.