Scripting error: write_notes.groovy Thread poster: Kepler Lee
| Kepler Lee Taiwan Local time: 16:48 English to Chinese + ...
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 (X) United States Local time: 04:48 Russian to English + ... | Didier Briel France Local time: 10:48 English to French + ... | Kepler Lee Taiwan Local time: 16:48 English to Chinese + ... TOPIC STARTER
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 Netherlands Local time: 10:48 Member (2006) English to Afrikaans + ...
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 » |
| | Anycount & Translation Office 3000 | Translation Office 3000
Translation Office 3000 is an advanced accounting tool for freelance translators and small agencies. TO3000 easily and seamlessly integrates with the business life of professional freelance translators.
More info » |
|
| | | | X Sign in to your ProZ.com account... | | | | | |