Skip to main content
andranika45761163
Known Participant
June 2, 2020
Answered

ExtendScript Harden Variables

  • June 2, 2020
  • 1 reply
  • 1267 views

Hi.

Does anybody know how to harden variables in ExtendScript ?

    This topic has been closed for replies.
    Correct answer frameexpert

    🙂  
    I have this function and not able to go forward. do you have any suggestion ?

    function HardenVariables(doc)
    {
      var varObj = doc.FirstVarInDoc;
      while (varObj.id != 0) {
        oNextVar = varObj.NextVarInDoc

      // Harden Variables   --------

        varObj = oNextVar;
      }
    }


    I am still not sure what you mean by "Harden". If you want to programmatically convert variables to text, you can do something like this:

     

    var doc, varFmt;
    
    doc = app.ActiveDoc;
    varFmt = doc.GetNamedVarFmt ("Test");
    varFmt.Delete ();

    This will convert any "Test" variables to text. Note that you can't delete System Variable formats; only User Variable formats.

    1 reply

    frameexpert
    Community Expert
    Community Expert
    June 2, 2020

    What do you mean by "harden variables"?

    www.frameexpert.com
    Bob_Niland
    Community Expert
    Community Expert
    June 2, 2020

    My guess would be that 'harden' means de-reference (convert) to text.

     

    If so, since FM has a button for that in the Variables pod, which pops a dialog with further options, I'd be surprised if it can't be scripted.

    frameexpert
    Community Expert
    Community Expert
    June 2, 2020

    Thanks, Bob. I didn't think of that. Yes, that can be scripted.

    www.frameexpert.com