Copy link to clipboard
Copied
Hello everyone,
i'm making a script to resize, proportionally from the center, a text object depending on the content of another text object.
This is what i made so far
var text1 = activeDocument.textFrames.getByName("TEXT1");
var text2 = activeDocument.textFrames.getByName("TEXT2");
if (text2.contents == "caseA") {
text1.resize(10, 10, AnchorPoint.MIDDLE_CENTER);
}
It looks like "AnchorPoint" it's not known, it's not the right way.
Does anyone know what's teh correct way to do it?
Cheers!
Hi @Magenta s.r.l. ,
In Illustartor it is Transformation. Please see screenshot for resizeAPI what parameters are passed to the resize method and in which order.
Also, you can try the following code
var text1 = activeDocument.textFrames.getByName("TEXT1");
var text2 = activeDocument.textFrames.getByName("TEXT2");
if (text2.contents == "caseA") {
text1.resize(10, 10, true, true, true, true, 100, Transformation.CENTER);
}
Copy link to clipboard
Copied
Hi @Magenta s.r.l. ,
In Illustartor it is Transformation. Please see screenshot for resizeAPI what parameters are passed to the resize method and in which order.
Also, you can try the following code
var text1 = activeDocument.textFrames.getByName("TEXT1");
var text2 = activeDocument.textFrames.getByName("TEXT2");
if (text2.contents == "caseA") {
text1.resize(10, 10, true, true, true, true, 100, Transformation.CENTER);
}
Copy link to clipboard
Copied
Hi @Charu Rajput and thank you again! The script works just fine (obviously) and i really appreciate the expanation, really exhaustive. have a really good day!
Cheers
P.S. Where can i find info such those you shared?
Copy link to clipboard
Copied
Welcome @Magenta s.r.l. 🙂
Here is the link for the documentation that you can refer.
https://www.indesignjs.de/extendscriptAPI/illustrator-latest/#Application.html
Copy link to clipboard
Copied
This is perhaps a little too thick, but how about
text1.transform(getScaleMatrix(10,10));