Copy link to clipboard
Copied
// In my active Indesign document, there is a Text variable named myRevisionNR, type: modified text, which can be: "00", or "01" or "02", etc.
// How can I display the "value" of my tex variable myRevisionNR?
//
// Create text variable
var myDocVariables = app.activeDocument.textVariables;
var myDocVariablesNames = myDocVariables.everyItem(0).name;
// The following sentence only displays: "myRevisionNR". But I want to see: "01", or "02"
alert(myDocVariablesNames[0])
// Who can help me?
Copy link to clipboard
Copied
Hello,
Try this ...
// get text variable value
var myValue= app.activeDocument.textVariables.item('myRevisionNR').variableOptions.contents;
alert(myValue)
// set text variable value
app.activeDocument.textVariables.item('myRevisionNR').variableOptions.contents = '03';
Copy link to clipboard
Copied
Hello Ronald63,
Thank you very much! You made my day great!
Copy link to clipboard
Copied
This is what you are looking for:
InDesign ExtendScript API (12.0)
(app.activeDocument.textVariables[0].associatedInstances[0].resultText)
Copy link to clipboard
Copied
Hello Vamitul,
Thank you for answerign my question. I will take a look at it.