Adobe Illustrator Scripts by Hiroyuki Sato

Scripts to Perform Vector Manipulations in Adobe Illustror

This project is maintained by Hiroyuki and Shanfan


Please note that this page is no longer actively maintained. Hiroyuki dedicated this website to all the future updates.

The Scripts

This repository includes a "js" and a "jsx" folder. They are the same scripts but "js" folder includes ".js" extension and Windows newline (CRLF). Maybe suitable for old CS on Windows.

Adjust Dashes-offset

fig.1 : This script adjusts dashed lines in the selection in order to the center of the first dash comes at each anchor points.
For its purpose, when adjacent segments of an anchor of the target path have a difference in length, a rectangle like above, for example, this script splits the path at this anchor, applies a suitable dash setting for each splitted path, then put them into a group. This is a lockstep trick caused by an Illustrator path can have only one simple rule for dashes and gaps. This process also CLEARS FILL COLORS, if it needs, and if the pash has BUTT end cap, change it to PROJECTION end cap.

fig.2 : The left figure is splitted with pathfinder ( outline ), in order to make anchors at all intersection points.

Adjust Dashes

adjusts the lengths of dashes and gaps of dashed lines in order to the length of the path is divisible by total length of dashes and gaps.

Arc Correction

corrects free-hand drawn arc-like paths in the selection. To use, just select the paths and run this script.

For the (not need-to-know) detail of the method, please read the comments inside of the script with above figure.

Archimedean Spiral

draws an (approximated) Archimedean spiral.

Arrow-A, Arrow-V

draws an arrow for each selected end (anchor) of the selected paths.

"A" and "V" mean the shape of the head of the arrow. The visible peaks of arrows exactly locate at each visible end of the selected paths. The end of paths are trimmed in order to avoid sticking out from the head of the arrow. The path with projection end cap is modified to but end cap.


draws a circle with specified number of anchor points.


draws circumcircles for each selcted path

The major reason why I wrote this script is to draw a "circumcircle" for a star.
So the method to find the center and the radius for the circumcircle is rather incertitude.

  1. find out a perpendicular bisector for the line connecting 1st and 2nd anchor
  2. do the same for 1st and 3rd anchor (if the path is a triangle, 2nd and 3rd anchor)
  3. find out intersection point of 1 and 2. for the center of the circumcircle to draw
  4. find out the length of the line connecting the center and 1st anchor, then do the same for the center and 2nd anchor. define longer one as the radius of the circumcircle to draw.

The rightmost one in the figure above is a case of failure.

Common Tangents

draws common tangents to the selected curved lines, if they are detected.

Cut At Selected Anchors

cuts selected paths at each selected anchor.


adds a new layer and draws dancing people on it

The dancers are made with various width of lines. So please remember to adjust the setting of Scale Tool for scaling strokes.

Divide Length

divides each selected segment into specified number based on the length.

The length of each segment is equally distributed.

Dup At Selected Anchors

duplicates the foreground object in the selection at the locations of the rest of each selected anchor points.

Extend Handles

extends all handles of selected anchor points with specified rate.

100 : original size
120 : extend 20%
80 : shorten 20%
0 : remove handles
-100 : reverse handles

Join Reasonably

joins the open paths in the selection together with reasonable order

Merge Overlapped Anchors

merges nearly overlapped anchor points.
It also reports how many anchor points had been reduced.

To use, simply select the path(es) and run this script.

Metaball-Arc, Metaball

creates Metaball-like shapes

Metaball-Arc uses arcs to connect. Metaball uses suitable bezier curves.

How To Use

  1. Draw some circles and select them, then run this script.
  2. When a prompt appears, type in an optional value for the the connecting curves, then click OK.

It doesn't check in the script whether each path is really a circle. So have fun with other shapes...

Combining the shapes using Pathfinder may results several overlapping anchor points on the path. if it occurs, it may help to solve it to use my another script "Merge Overlapped Anchors.js". (See above)

Path Length

finds out length of the each selected path, and total length of the selected paths. Then write out them on the artboard as text object.

This script uses JavaScript's "length" property of PathItem. if it is available (= CS3 or later). You can force calculate the length by "use_native_property" setting set to false. (See comments inside the script )

The returned values of "PathItem.length" property and the function in this script are slightly different especially in complex paths. It seems that the difference is 0.05 millimeter at most.

Remove Anchors

removes selected anchor points


reverses the order of the anchor points of each selected paths

Round Any Corner

rounds selected corners of PathItems.

Especially for the corners at the intersection point of curves, this script may work better than "Round Corners" filter, but slower.

How To Use

Illustrator CS
1. Select the anchor(s) or whole path(es) to round.
2. Run this script. A prompt box appears to set the rounding radius.
3. Input the radius in point, then click OK.

You can choose a behavior like Illustrator10 by change the setting. See "setting" section inside the script.

Illustrator 10
1. Select the anchor(s) or whole path(es) to round

A foreground path will be used to specify the rounding radius - Half width of foreground path is used for the radius, excluding stroke width. So a circle is the most suitable for intuitive understanding and ease of use. The script would ask you to choose if there's a difference greater than 1pt between width and height of foreground path.

  1. Run this script. The foreground path is removed after rounding.
    > When the number of selected path is 1, predefined radius is used for rounding. (See "setting" section inside the script)

Rounding Method
Basically, the rounding method is compatible with the "Round Corners" filter. It is to add two anchors instead of the original anchor, at the points of specified line length from each selected corner. So if there're too many anchors on original path, this script can not round nicely.

Actually, the specified "radius" is not for a radius of arcs which drawn. It is for the line length from each selected corner and is for the base to compute the length of handles. The reason calling it "radius" is for compatibility with the "Round Corners" filter.

This script does not round the corners which already rounded. For example, select a circle and run this script does nothing.
In the rounding process, the script merges anchors which when the distance between anchors is less than 0.05 points.
This script does not work for some part of compound paths. When this occurs, please select part of the compound path or release the compound path and select them, then run script again.
I still have not figured out how to get properties from grouped paths inside a compound path.

Sine Curve

draws (approximate) sine curve at the origin of the artboard
The values of the coordinates are based on Don Lancaster's Guru's Lair Cubic Spline Library.

Tangents From A Point

draws tangent lines from a selected anchor point to selected curved segments.

This script tries to find a path with only 1 anchor selected, from foreground to background. And specifies the selected point of the path as starting point of tangents.
"the selected curved segments" means the rest of the selected paths.

You can use an isolated point as the starting point. In this case, starting isolated point is removed after drawing tangents.

Drawn tangents have handles at ends. So you can move the starting side of anchor point with keeping tangency.


draws a tree-like shape at the center of the artboard

The trees are made with various width of lines. So please be careful about the setting of Scale Tool when you want to scale them.

General Notes For Usage

Tested with Adobe Illustrator CS5, Windows XP SP3 (Japanese version).
Tested basic functions with CS6 tryout, Mac OS X 10.6.8 (Japanese version).

How to Use the Scripts

Choose File>Scripts>Browse, and open the script to run.
Or place the script in the directory "Adobe Illustrator CS3\Presets\Scripts", then restart Illustrator.
Download the PDF documents for more information.

Selecting parts of a path

Some scripts work only for selected anchor points or sides (= lines, bezier curve segments). A side (= a line, a bezier curve segment) means one of each line segment drawn to connect a couple of anchor points. In other words, selected parts means targets for Cut or Copy command. Regular (or Group) Select Tool selects whole of a path.

Select the path

A Compound Path Issue

Some scripts don't work for some part of compound paths. When this occurs, please select part of the compound path or release the compound path and select them, then run script again. I still have not figured out how to get properties from grouped paths inside a compound path.

Illustrator 10 Issue

All the scripts was written to be compatible with AI 10 through CS3 (or later?). Only problem is AI 10 lacks a prompt dialog that users can specify the optional values. For now, one of the solution for this is to edit the scripts manually to change the default value of these varibles. They are most often placed in the beginning of the scripts with the appropriate comments.

Authors and Contributors

The scripts are created by Hiroyuki Sato (@shspage), and uploaded on GitHub by Shanfan Huang(@shanfan).

Copyright©2013 Hiroyuki Sato
This script is distributed under the MIT License. See the LICENSE file on GitHub for details.
Free to use and distribute.