Copy link to clipboard
Copied
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
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
i just want to turn on or off this auto size property through Jsx .
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
ya sure Qwertyfly... please go ahead . and let me know if some how possible.
Thanks
Copy link to clipboard
Copied
this could be harder then I first thought.
I assumed Silly-V had tested the Action-ability of the auto feature.
this feature was added to illustrator cc2014.
looks like adobe just stuffed it in with out integrating it in to Javascript, or actions.
one more short fall from the programming team.
we could set the frame to fit the text.
but that will not make it auto fit if you then edit the text.
I may need to know a bit more about what you are trying to achieve.
then we may be able to find another way around.
Is this just for you, or is it going to be run on other machines?
Are you on Mac or PC?
Is the text frame content formatted in a set and simple way?
or is it multi coloured and many sizes and styles?
Copy link to clipboard
Copied
Hi Qwertyfly...
i'm a windows user but the plugin that i'm working on need to be supported at both mac and windows , this should get worked on other machines also,
what i want to achieve is to traverse through all the text Frames and toggle its auto size property like sometimes i do not need to auto size a single text frames for some reasons.
Text frame content is formatted in a simple way with single color.
Copy link to clipboard
Copied
it is simple enough to resize the text frame to fit the current content.
but I am not sure that is going to be what you want.
the only work around I can think of will be to:
for each textFrame get details like font size, colour, width, etc..
load contents to a variable.
then I need to get an existing text frame that has the auto feature set and duplicate that.
change all its setting to the original text frame and fill it with the contents we collected previously.
then we can remove the original frame.
just need to decide how to get the existing frame that has the auto feature already set.
this could be from a small file saved on the computer somewhere.
leave it with me and I'll see if I can get it to work.
this is just the spill over of my thought process, I'm having a hell of a day today and needed to put it in writing before it gets pushed out by the next thick client who wants to request 2000 pens printed 4 colours and delivered to some unknown country location by monday.
sorry about that, It does make me feel better to vent though...
Copy link to clipboard
Copied
I was able to record the action in CC 2015, maybe they didn't have it recordable in 2014 though.
Oh doy! That's right, it records a bunch of properties except the Auto-Size! How lame!
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Nice work Ten A,
this will make it much simpler.
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
Super useful - thanks Qwertyfly.
Copy link to clipboard
Copied
Nice work Ten A
Thank you so much , and also thanks to Qwertyfly... you made it
Copy link to clipboard
Copied
no problem, I hope its a help.
I learnt a few things in the process.
cheers for the snippet Ten-A.
Copy link to clipboard
Copied
save my day, good job.