Home (Japanese Page)
Scripts for Adobe Illustrator CS (JavaScript)
download: aics_scripts_en.zip -- 2008-03-28 : added "Tangents From A Point.js"
This archive includes following sample scripts (not well commented yet confused)
tested with Adobe Illustrator CS 11.0.1, Windows 2000 SP4 (Japanese version).
Free to use and distribute.
- # General Note For Usage
- Circle
- Metaball
- Merge Overlapped Anchors
- Divide (length)
- Round Any Corner
- Adjust Dashes
- Tree-like
- Dance
- Common Tangents
- Tangents From A Point
- Extend Handles
- Reverse
Other Contents Related to Scripting:
• Scriptographer Scripts
• Illustrator Scripts ( Japanese Page )
Author : SATO Hiroyuki -
# General Note For Usage
• How to Use the Scripts
Choose File>Scripts>Browse, and open the script to run.
Or place the script in the directory "Adobe Illustrator CS\Presets\Scripts", then restart Illustrator.
Download the PDF documents for more information. http://www.google.com/search?q=site:partners.adobe.com+illustrator+CS+javascript
"Adobe Illustrator CS Scripting GettingStarted with JavaScript"
"Adobe Illustrator JavaScript Reference"
• Selection of Part of a Path
Some scripts work only for selected anchor points or segments. A "segment" means a line 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. - [fig.]
• A Compound Path Issue
Some scripts don't work for some part of compound pathes. 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 pathes inside a compound path.
Circle
// draws a circle with specified number of anchor points.
Metaball
// This script may help to create a Metaball-like shape.
// USAGE : Draw some circles and select them, then run this script.
// When a prompt box appears, type in a number for the (minimum) diameter of the connecting arcs, then click OK.
// // (it doesn't check in the script whether each path is really a circle)
// # 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".
// This is a simple sample script that merges overlapping anchors on the path.
Merge Overlapped Anchors
// merges nearly overlapped anchor points.
// also reports how many anchor points had been reduced.
// USAGE: Select the path(es) and run this script.
Divide (length)
// divides each selected segment into specified number. based on the length.
// Length of each segment in each divided segments is equal.
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.
// Input the radius in point, then click OK.
// #. You can choose a behavior like Illustrator10 by change the setting.
// (-- see "setting" section below)
// ## Illustrator 10
// 1. Select the anchor(s) or whole path(es) to round
// WITH a foreground path that specifies the rounding radius.
// Half width of foreground path is used for the radius. (excluding stroke width)
// Using a circle is most suitable for intuitive understanding and ease of use.
// The script asks you to continue if there's a difference greater than 1 pt
// between width and height of foreground path.
// 2. 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 below)
// ## 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.
// ## Radius
// 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)
// ### notice
// In the rounding process, the script merges anchors which nearly
// overlapped (when the distance between anchors is less than 0.05 points).
// This script does not work for some part of compound pathes.
// 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 pathes inside a compound path.
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
Tree-like
// draws a tree-like shape at the center of the artboard
// ### notice
// The tree is made with various width of lines.
// So please be careful about the setting of Scale Tool
// when you want to scale it.
Dance
// adds a new layer and draws dancing people on it
// ### notice
// The dancers are made with various width of lines.
// So please be careful about the setting of Scale Tool
// when you want to scale them.
Common Tangents
// Draws common tangents to the selected curved lines, if they are detected.
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 rest of the selected pathes.
// 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.// works on Illustrator 10 to CS
Extend Handles
// 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
Reverse
// reverses the order of the anchor points of each selected pathes
(c)2005, sh. All Rights Reserved.