Illustrator Scripting

Illustrator Scripting

1

This post has already been read 2962 times!

This is a sticky article about Illustrator Scripting, growing continuously as I find something…

Hex to RGB Snippet

 

RGB to Hex Snippet 1

RGB to Hex Snippet 2

Round Number Snippet

Greatest Common Factor

List All Active Fonts

Unlock All Visible Layers

Delete All Text Strings in Document

Delete Specified Type Items in Document

 

Question: How add multiple live strokes with different offset path settings using Javascript?

So recently I was trying to find a way to add multiple live strokes to a path.

question-1

First I have discovered “app.executeMenuCommand” commands.

Using those strings I was able to add stroke with an offset path.

But as I tried to put it inside of a loop it was showing dialogue for each step.

Then I have found this article luckly;

http://aiscripts.com/apply-live-effect-applyeffect-liveeffectxml/

It was based on an idea that puts all parameters inside of  an xml string.

I have changed couple of text in string in order to attach variables.

For example above ; R mlim miterlimitvalue was for Miter Limit Value which appears in Offset Path dialogue box.

Same way; Offsetvalue and Jointype were my variables.

As you can see above I was able to write “Round” as a text for jointype parameter.

But my next question was how to find these commands for xmlstring ; like “R mlim”.

In previously given link  I’ve mentioned above, was showing a way to get these commands as exporting your shape as Adobe FXG.

As an Illustrator CC 2015 user I could not see that extension. Made a research and learnt that it had been removed from newer CC products. Asked one of my friend who has Adobe Illustrator CS6 and sent him that file.

I basically draw one rectangle add new stroke and applied offset path. In FXG export options there is a button as Show Code; It generates temp text file. Inside of this xml we have all info for creating custom live effect scripts.

Here is a part of my sample exported code from FXG;

Other examples I have found;

 

 

1 Comment

  1. Caleb Gates
    Caleb Gates06-21-2016

    I’ve been searching everywhere for this “power function” and it looks to be the most useful tool in all of ExtendScript. I’m hardpressed to get access to CS6 and am wishing I could get the live effect for the pathfinder Divide function. I see you have a pathfinder however I continue to get errors while trying to use it. any suggestions on how to use pathfinder or access a .fxg file with pathfinder divide in it? Thanks

Leave a Reply