• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ExtendScript Harden Variables

Community Beginner ,
Jun 02, 2020 Jun 02, 2020

Copy link to clipboard

Copied

Hi.

Does anybody know how to harden variables in ExtendScript ?

Views

1.0K

Translate

Translate

Report

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

correct answers 2 Correct answers

Community Expert , Jun 02, 2020 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.

Votes

Translate

Translate
Community Expert , Jun 02, 2020 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.

Votes

Translate

Translate
Community Expert ,
Jun 02, 2020 Jun 02, 2020

Copy link to clipboard

Copied

What do you mean by "harden variables"?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 02, 2020 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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 02, 2020 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;
  }
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 02, 2020 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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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