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

resize, proportionally from the center, text object 1 depending on the content of text objet2

Participant ,
Dec 14, 2022 Dec 14, 2022

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!

TOPICS
Scripting
711
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 1 Correct answer

Community Expert , Dec 14, 2022 Dec 14, 2022

Hi @Delresto , 

In Illustartor it is Transformation. Please see screenshot for resizeAPI what parameters are passed to the resize method and in which order.

Screenshot 2022-12-14 at 10.09.21 PM.png

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

 

Translate
Adobe
Community Expert ,
Dec 14, 2022 Dec 14, 2022

Hi @Delresto , 

In Illustartor it is Transformation. Please see screenshot for resizeAPI what parameters are passed to the resize method and in which order.

Screenshot 2022-12-14 at 10.09.21 PM.png

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

 

Best regards
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
Participant ,
Dec 14, 2022 Dec 14, 2022

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?

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 ,
Dec 14, 2022 Dec 14, 2022

Welcome @Delresto 🙂

Here is the link for the documentation that you can refer.

https://www.indesignjs.de/extendscriptAPI/illustrator-latest/#Application.html

Best regards
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 ,
Dec 14, 2022 Dec 14, 2022
LATEST

This is perhaps a little too thick, but how about

text1.transform(getScaleMatrix(10,10));

 

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