8 Replies Latest reply: Jul 22, 2016 4:18 PM by Marcus Sommer RSS

    Get and Set variable functions in JScript

      Does anyone know what is the correct code for getting and setting variable value in JScript?


      I use the following code which is not working (obviously):


      function getVariable(varName) {

        var doc = ActiveDocument;

        var vget = doc.Variables(varName);

      getVariable = vget.Value;


      function setVariable(varName, varValue) {

        var doc = ActiveDocument;

        var vset = doc.Variables(varValue);

        vset.SetVariable(varName, varValue);

        doc = null;



      Thank you very much in advance.