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

Illustrator Transform Effect Count Field through Scripting

New Here ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

Hello everyone!

 

I am trying to retrieve or modify the value in the count field of a Transform Effect for a Text Frame in Illustrator using a JavaScript script. I have successfully been able to access the Text Frame and change the text, but I am struggling to figure out how to access the value in the count field for a sepesific Transform Effect.

 

I believe that it has to do with the matrix, but I haven't been able to find a way to access the Count field. I was hoping that someone could offer some guidance.

 

Any help or insights would be greatly appreciated!

Thank you in advance.

TOPICS
Scripting

Views

541

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
Guide ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

Can you elaborate on what you mean by "count field"?

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
Engaged ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

My best guess is that @Sam28345440o2p9 is referring to the copies option when applying a Transform Effect to an object (text in this case) like the attached screen. I'm pretty certain that information is not available via the API or I have never seen mention of it in any documentation.

 

Screen Shot 2023-02-13 at 17.07.31.png

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
Guide ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

If that's the case, it can be done.  This is a move transform effect with 3 copies (the number of copies is "numCopies" in the string):

var string = '<LiveEffect name="Adobe Transform"><Dict data="B transformPatterns 1 I numCopies 3 B randomize 0 R rotate_Degrees 0 R scaleV_Factor 1 I pinPoint 4 R rotate_Radians 0 R moveH_Pts 14.173 B scaleLines 1 R scaleH_Percent 100 B reflectX 0 B reflectY 0 R moveV_Pts -14.173 R scaleH_Factor 1 R scaleV_Percent 100 B transformObjects 1"/></LiveEffect>';
app.selection[0].applyEffect(string);

 

For unofficial documentation see here.  Also, @m1b has written a lot about scripting live effects; see here.

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
Engaged ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

@femkeblanco, oh wow, I didn't know that was a thing! Not sure if this is going to help the OP as he wants to retrieve and /or modify the copies value but still nice to know.

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 ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

LATEST

@jduncan is right. We don't have any access to anything but the basic appearance properties. We can add a new live effect but not modify an existing one (at least not via the scripting API—there are theoretically other ways, such as using the SDK perhaps, or even modifying the raw .ai file).

 

The best you could do in this case is something hacky like: duplicate, then expand the effect, then analyse the result to see how many copies it made, then remove the duplicate expanded objects, then reduce the object to the default basic appearance, then recreate it's basic appearance, then apply the live effect with the new value based on the number you found in the analysis step.

 

I'm not seriously suggesting you do that, but it seems possible to do.

 

Another approach—less-hacky and more reliable—would be to do the transform effect entirely by a script and group the resulting items with metadata continaing properties of the transform, such as distance translated and number of copies. Maybe a group that named a certain way could be interpreted by the script as an ersatz 'Transformed object"—so if there are, say, three items in the group then they are automatically considered copies of the first item, and the "count" is 3, and the distance [dx, dy] between the first and second items are the translation amounts. That script would then allow you to change the number and distances, etc quite easily. I like this idea.

- Mark

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