Special characters not displayed correctly in variable if inserted via script
(too old to reply)
Klaus Daube
2018-10-24 17:00:41 UTC
Dear all

I came across a nasty bug: Special characters not displayed correctly in variable if
inserted via script. Please vote on https://tracker.adobe.com/#/view/FRMAKER-5522

Script InsertVariable.jsx creates a variable with this content:

However, what is displayed, even after screen refresh:

A screen refresh has no influence. However after editing (replacing with itself) of
any character in the variable definition the display becomes correct.
There is no problem creating this variable manully via UI.

Using the corresponding Unicode characters is not an option, because this depends on
the font - which mostly do not contain these characters (U2009 THIN SPACE, U+2212

The test script inserts some text at the top of an open document. It then inserts a
variable into this text.

This happens with any FM since version 10 and ESTK (CC).

#target framemaker
TestInsertVariable (); // =======================================================

function TestInsertVariable () {
var paraText = "Far far away, behind the word mountains, far from the countries
Vokalia and Consonantia, there live the blind texts. "
var oDoc = app.ActiveDoc, sValue, sVarName, oTextLoc, oPgf, oTR;

if(oDoc.ObjectValid()) {
oPgf = oDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
oTextLoc = new TextLoc(oPgf, 0);
oDoc.AddText(oTextLoc, paraText); // create a paragraph
oTextLoc = new TextLoc(oPgf, 17); // arbitrary place
sVarName = "GugusVariable";
// sValue = "--- Anything I want to see in my variable ---";
sValue = "\\+9\\st007\\st199\\st254\\st740\\st991"; // \ to be doubled in
InsertVariable (oDoc, oTextLoc, sVarName, sValue);

} else {
alert ("Document does not exist or is invalid");
} //--- end TestInsertVariable

function InsertVariable (oDoc, oTextLoc, sVarName, sValue) {
// Arguments oDoc: current document
// oTextLoc: where to insert the variable
// sVarName: name of the variable, it may already be in the catalgoue
// sValue: contents of the variable
var oVar, oNewVar;

if (!oDoc.GetNamedVarFmt(sVarName).ObjectValid()) { // needs to be defined first
oNewVar = oDoc.NewNamedVarFmt(sVarName);
oNewVar.Fmt = sValue;
oVar = oDoc.NewAnchoredFormattedVar (oNewVar.Name, oTextLoc); // insert at
} else {
oVar = oDoc.NewAnchoredFormattedVar (sVarName, oTextLoc); // already defined,
just insert
} //--- end InsertVariable
Klaus Daube Phone: +41-44-381 37 77
Schäracher 11 Mail: ***@daube.ch
CH-8053 Zürich Web: www.daube.ch


This message is from the Framers mailing list

Send messages to ***@lists.frameusers.com
Visit the list's homepage at http://www.frameusers.com
Archives located at http://www.mail-archive.com/framers%40lists.frameusers.com/
Subscribe and unsubscribe at http://lists.frameusers.com/listinfo.cgi/framers-frameusers.com
Send administrative questions to ***@frameusers.com

Continue reading on narkive: