Skip to main content
Upendra_sengar
Inspiring
October 7, 2015
Answered

can we set auto size property for text Frames through jsx ?

  • October 7, 2015
  • 2 replies
  • 2784 views

is it possible to set auto size property for text Frames through jsx. this option is present in Area type options dialog in illustartor.

To open dialog.

select a textFrame --> Type -->Area type Options. --> now can see property auto size checkbox.

Any help or suggestion will be appreciated,

Thanks ,

Upendra

This topic has been closed for replies.
Correct answer Ten A

We can set preference of auto sizing:

app.preferences.setBooleanPreference("text/autoSizing",

  !app.preferences.getBooleanPreference("text/autoSizing"));

You have to run script before adding tetFrames.

2 replies

Ten A
Community Expert
Ten ACommunity ExpertCorrect answer
Community Expert
October 9, 2015

We can set preference of auto sizing:

app.preferences.setBooleanPreference("text/autoSizing",

  !app.preferences.getBooleanPreference("text/autoSizing"));

You have to run script before adding tetFrames.

Qwertyfly___
Legend
October 9, 2015

Nice work Ten A‌,

this will make it much simpler.

Qwertyfly___
Legend
October 9, 2015

Here is my working example.

this should set all AreaText in document to auto size and keep the same width and position.

function setAutoTextFrames(){

    var autoSize = app.preferences.getBooleanPreference("text/autoSizing");

    app.preferences.setBooleanPreference("text/autoSizing", true); 

    var doc = app.activeDocument;

    var txt = doc.textFrames;

    var content;

    for(var i= txt.length-1; i>-1; i--){

        if(txt.kind == "TextType.AREATEXT"){

            content = txt.contents;

            txt.contents = "This is just a random string of text to keep the width of the text frame stable while we convert to point text then back to area text";

            txt.convertAreaObjectToPointObject();

            txt.convertPointObjectToAreaObject();

            txt.contents = content;

        }

    }

    app.preferences.setBooleanPreference("text/autoSizing", autoSize);

}

setAutoTextFrames();

if you text boxes are wider then the random string then make the random string longer...

Silly-V
Legend
October 7, 2015

I don't see a property like that in the OMV, but I do see that it is a recordable action. So, at least, you can record your action and have your script play it.

Upendra_sengar
Inspiring
October 7, 2015

i just want to turn on or off this auto size property through Jsx .

Qwertyfly___
Legend
October 7, 2015

Silly is correct as far as I can see.

and the best way to deal with it will be via an action.

the action can be created, run and removed, all from the script.

I would be happy to help with this if you want.

I have to go collect the children now but will have a play with it tomorrow for you.