Skip to content

jsmentch/IllustratorArt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Illustrator art with code

Small experiments in Adobe Illustrator scripting (ExtendScript, .jsx): documents, layers, paths, CMYK color, and generative layouts. This repo keeps an original scratch script as a snapshot and adds clean, runnable examples you can open and learn from.

What is Illustrator scripting?

Illustrator can be driven with JavaScript for ExtendScript (legacy engine, still widely used). Scripts talk to the app object: create documents, add pathItems, set fills, loop with randomness, and so on. The same language ideas as browser JS apply (for loops, functions, Math.random), but the DOM is Illustrator’s object model, not HTML.

For the newer UXP plugin model the APIs differ; everything under scripts/ here targets File → Scripts style ExtendScript.

How to run a script

  1. Open Adobe Illustrator.
  2. File → Scripts → Other Script… (macOS/Windows).
  3. Choose an .jsx file from this repo, for example scripts/examples/03-random-cmyk-rectangles.jsx.
  4. Illustrator executes the script; many samples call app.documents.add(), so you get a new document each run.

Optional:

  • Put scripts (or aliases) in Illustrator’s Scripts folder so they appear under File → Scripts without browsing. Typical locations are documented in Adobe’s scripting guide (user Presets folder per OS/version).
  • Use ExtendScript Toolkit (deprecated but still referenced) or VS Code with a JSX/ExtendScript workflow if you want breakpoints and $.writeln output in a JavaScript console for debugging.

Repository layout

Path Purpose
scripts/script_illustrator.jsx Archive — original experiments: commented blocks, nested layers, random rectangles, and commented path/staff snippets. Left intentionally as-is.
scripts/examples/*.jsx Teaching scripts — same ideas split into small, commented files (01–05).
png/ Raster exports / screenshots for the gallery below.
svg/ Vector exports where relevant.
ai/ Native Illustrator artwork linked to some experiments.

Example scripts (recommended starting order)

File What it demonstrates
01-document-and-layers.jsx app.documents.add(), layers.add(), nested layer names.
02-paths-stroke-and-fill.jsx pathItems.add() + setEntirePath, pathItems.rectangle, CMYKColor, stroke width, opacity.
03-random-cmyk-rectangles.jsx Loops, Math.random, many overlapping shapes (similar to the active part of the archive script).
04-nested-loop-lines.jsx Nested for loops driving line endpoints.
05-music-staff.jsx A reusable staff() function and repeated calls.

Coordinates: pathItems.rectangle(top, left, width, height) and setEntirePath([[x, y], …]) use Illustrator’s document coordinate system (points). If art looks off-screen, adjust the numeric ranges to match your artboard or ruler origin.

Performance: Scripts that create thousands of objects (e.g. example 03) can be slow; reduce count while iterating.

Gallery

Outputs vary with randomness and document settings; these images are from earlier runs and related artwork in this repo.

Random CMYK rectangles

Script output sample

Graph-style test

Script output sample 2

Additional assets in png/ (script44-01.png, Untitled-1-01.png, test.png, …) are extra exports you can browse locally.

Further reading

  • Adobe Illustrator scripting — official entry point and PDF scripting guides.
  • Object model reference: look for Illustrator JavaScript Scripting Reference in Adobe’s developer materials for the exact properties on PathItem, Layer, Document, etc.

License

MIT — Copyright (c) 2026 Jeff Mentch.

About

Scripts and samples for generating vector art in Adobe Illustrator

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors