Skip to main content
Participating Frequently
July 5, 2011
Question

Script to Make all text Dynamic

  • July 5, 2011
  • 2 replies
  • 22894 views

Is there a way or a script that will make all the text on a page Dynamic? At the moment we have to select each text box and press 'make text dynamic', which can get tiresome with a lot of text boxes. If we select all the text boxes and do the same we get a lot of variables with the same name which gives an error.

So we need a script that can make it all dynamic with different named variables.

Anyone....

This topic has been closed for replies.

2 replies

bsf2017
Inspiring
April 12, 2017

How can I test the length of the itext variable, i.e. how long the text in my text box is?

itext.contentVariable.length produces "unknown".

Thanks

Silly-V
Legend
April 13, 2017

You can only do this when the variable's text is populated into the text frame. It then could be retrieved like this: app.activeDocument.textFrames[0].contents

CarlosCanto
Community Expert
Community Expert
July 6, 2011

here you go, it doesn't deal with errors. Delete all existing variables before running.

#target illustrator

// script.name = makeAllTextDynamic.jsx;

// script.description = makes ALL text Dynamic, creates Variables;

// script.required = one document with at leas one textFrame;

// script.parent = CarlosCanto // 7/5/11;

// script.elegant = false;

var idoc = app.activeDocument;

for (i=0; i<idoc.textFrames.length; i++)

     {

          var itext = idoc.textFrames;

          var idocvar = idoc.variables.add();

          idocvar.kind = VariableKind.TEXTUAL;

          itext.contentVariable = idocvar;

     }

Participating Frequently
February 16, 2013

Wow thanks for this! I just starting using this for some translation work I'm doing.

One question - how could I get it to only look at what is on the artboard and ignore text boxes that are on the pasteboard?

Thanks in advance! Very appreciated.

femkeblanco
Legend
August 22, 2021

Hi! I know this is a very old post but I will try a longshot here anyway. I am not experienced in scripting for Adobe applications, but I tried copying your script and saving it with an jsx extension but no variables are created when I select text and run script from Files menu. Any Idea what I might be doing wrong?

Best regards

Are


#target illustrator
// script.name = makeActiveLayerTextDynamic.jsx;
// script.description = makes ALL text in the Active Layer Dynamic, creates Variables;
// script.required = one document with at least one textFrame;
// script.parent = CarlosCanto // 04/17/14;
// script.elegant = false;
var idoc = app.activeDocument;
var ilayer = idoc.activeLayer;
for (i = 0; i < ilayer.textFrames.length; i++) {
    var itext = ilayer.textFrames[i];
    var idocvar = idoc.variables.add();
    idocvar.kind = VariableKind.TEXTUAL;
    itext.contentVariable = idocvar;
}