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

ExtendScript Harden Variables

Community Beginner ,
Jun 02, 2020 Jun 02, 2020

Hi.

Does anybody know how to harden variables in ExtendScript ?

1.3K
Translate
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.

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.

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

What do you mean by "harden variables"?

Translate
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

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.

Translate
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

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

Translate
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

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

Translate
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

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.

Translate
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
LATEST

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

Translate
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