ExtendScript Harden Variables

Community Beginner ,
Jun 02, 2020

Copy link to clipboard

Copied

Hi.

Does anybody know how to harden variables in ExtendScript ?

Views

886

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

2 Correct Answers

Adobe Community Professional , Jun 02, 2020
frameexpert Adobe Community Professional , Jun 02, 2020
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.

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional , Jun 02, 2020
Bob_Niland Adobe Community Professional , Jun 02, 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.

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Jun 02, 2020

Copy link to clipboard

Copied

What do you mean by "harden variables"?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jun 02, 2020

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jun 02, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Jun 02, 2020

Copy link to clipboard

Copied

🙂  
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;
  }
}

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jun 02, 2020

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
andranika45761163 AUTHOR LATEST
Community Beginner ,
Jun 02, 2020

Copy link to clipboard

Copied

seems, it does what i need. still testing. thanks.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more