Scripting error: write_notes.groovy
Thread poster: Kepler Lee
Kepler Lee
Kepler Lee
Taiwan
Local time: 23:30
English to Chinese
+ ...
Dec 11, 2015

A groovy (write_notes) downloaded from "http://wp.me/p3fHEs-9N" works well in OmegaT 3.5.2 version originally.
However, when I install and run 3.5.3 version, this script (and some other scripts, such as write_table.groovy from http://wp.me/p3fHEs-7L) can not work well now.

Initially, the 3.5.3 version without attached JRE is installed (I do so because I think that JRE already exists in 3.5.2 ve
... See more
A groovy (write_notes) downloaded from "http://wp.me/p3fHEs-9N" works well in OmegaT 3.5.2 version originally.
However, when I install and run 3.5.3 version, this script (and some other scripts, such as write_table.groovy from http://wp.me/p3fHEs-7L) can not work well now.

Initially, the 3.5.3 version without attached JRE is installed (I do so because I think that JRE already exists in 3.5.2 version, there is no need to reinstall JRE).
In this morning, I download and install the 3.5.3 version with attached JRE and try again. The situation remains without change.

Is there any solution?
Alternatively, is there any safe method to go back to run 3.5.2 version without losing my current settings?

The message of running the script is as following:
The script "E:\MyDocument\翻譯語言\0CAT\OmegaT\Scripts\write_notes.groovy" is running...
An error occurred
javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: static org.omegat.util.StaticUtils.makeValidXML() is applicable for argument types: (java.lang.String) values: [V-groves:V-grooves:已改]

In case the groovy cannot be downloaded, refer to the following pasted code.

/* THIS SCRIPT HAS BEEN SPONSORED BY TRANSLATION AGENCY VELIOR [ http://velior.ru ]
*
* #Purpose: Export the project into a HTML table
* #Files: Writes 'project_table.html' in the 'script_output' subfolder
* of current project's root. Each source file is exported to a separate
* table that has the name of the file as its heading, all source segments
* in the left column and corresponding target segments in the right.
* #Details: http://wp.me/p3fHEs-7L
*
* @author: Kos Ivantsov
* @date: 2014-01-16
* @version: 0.2
*/

import static javax.swing.JOptionPane.*
import static org.omegat.util.Platform.*
import org.omegat.util.StaticUtils

def prop = project.projectProperties
if (!prop) {
final def title = 'Export project to table'
final def msg = 'Please try again after you open a project.'
showMessageDialog null, msg, title, INFORMATION_MESSAGE
return
}
def folder = prop.projectRoot+'script_output/'
projname = new File(prop.getProjectRoot()).getName()
table_file = new File(folder + projname + '.html')
// create folder if it doesn't exist
if (! (new File (folder)).exists()) {
(new File(folder)).mkdir()
}
count = 0
table_file.write("""\
\n

""", 'UTF-8')

files = project.projectFiles
for (i in 0 ..< files.size())
{
fi = files[i]
table_file.append("""\

$fi.filePath\n""", 'UTF-8')
for (j in 0 ..< fi.entries.size())
{
ste = fi.entries[j]
source = ste.getSrcText()
target = project.getTranslationInfo(ste) ? project.getTranslationInfo(ste).translation : null;
if (target == null)
target = "zzznullzzz"
if (target.size() == 0 )
target = ""
source = StaticUtils.makeValidXML(source)
target = StaticUtils.makeValidXML(target).replaceAll(/zzznullzzz/, /⁠/)
table_file.append("""\
$source
$target""", 'UTF-8')
count++
}
table_file.append(" \n", 'UTF-8')
}
table_file.append("\n", 'UTF-8')
console.println "$count segments written to $table_file"
Collapse


 
Susan Welsh
Susan Welsh  Identity Verified
United States
Local time: 11:30
Russian to English
+ ...
post question to Yahoo group Dec 11, 2015

Techie questions like this are best posted to the OmegaT Yahoo group
https://groups.yahoo.com/neo/groups/OmegaT/conversations/messages
Kos Ivantsov is a regular contributor there and I'm sure he will help you. I don't think he's on Proz.


 
Didier Briel
Didier Briel  Identity Verified
France
Local time: 17:30
English to French
+ ...
Indeed, the answer is in the Yahoo group Dec 11, 2015

Susan Welsh wrote:
Techie questions like this are best posted to the OmegaT Yahoo group
https://groups.yahoo.com/neo/groups/OmegaT/conversations/messages
Kos Ivantsov is a regular contributor there and I'm sure he will help you. I don't think he's on Proz.

See
https://groups.yahoo.com/neo/groups/OmegaT/conversations/messages/36979
for a solution to the issue.

Didier

[Edited at 2015-12-11 13:04 GMT]


 
Kepler Lee
Kepler Lee
Taiwan
Local time: 23:30
English to Chinese
+ ...
TOPIC STARTER
Work now Dec 11, 2015

Thank Didier for the direct link! The script works after modification.
Thank Susan for the good group message! I made registration few minutes ago.


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 17:30
Member (2006)
English to Afrikaans
+ ...
Kos' reply Dec 11, 2015

Didier Briel wrote:
See
https://groups.yahoo.com/neo/groups/OmegaT/conversations/messages/36979
for a solution to the issue.


Essentially, change "StaticUtils" into "StringUtil" everywhere in the script.


 


There is no moderator assigned specifically to this forum.
To report site rules violations or get help, please contact site staff »


Scripting error: write_notes.groovy






Trados Studio 2022 Freelance
The leading translation software used by over 270,000 translators.

Designed with your feedback in mind, Trados Studio 2022 delivers an unrivalled, powerful desktop and cloud solution, empowering you to work in the most efficient and cost-effective way.

More info »
Protemos translation business management system
Create your account in minutes, and start working! 3-month trial for agencies, and free for freelancers!

The system lets you keep client/vendor database, with contacts and rates, manage projects and assign jobs to vendors, issue invoices, track payments, store and manage project files, generate business reports on turnover profit per client/manager etc.

More info »