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

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

Explorer ,
Dec 14, 2022 Dec 14, 2022

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!

TOPICS
Scripting

Views

262

Translate

Translate

Report

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 @Kangi Sportswear , 

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

 

Votes

Translate

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

Copy link to clipboard

Copied

Hi @Kangi Sportswear , 

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

Votes

Translate

Translate

Report

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

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?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Welcome @Kangi Sportswear 🙂

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

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

Best regards

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

This is perhaps a little too thick, but how about

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

 

Votes

Translate

Translate

Report

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