Skip to content
Tutorials Center
My learning

Topics

Lesson 33 of 36 ยท Export and Workflows

Libraries, Actions and Scripting in Illustrator

Automate repetitive work in Adobe Illustrator with CC Libraries, the Actions panel, Image Trace presets and ExtendScript, plus a runnable JavaScript stand-in that batch-renames artboards.

The more projects you do, the more you repeat yourself: the same brand colors, the same export steps, the same renaming. Illustrator offers several levels of automation. This lesson goes from simplest to most powerful: libraries, graphic styles and symbols, actions and scripts.

Illustrator does not run on this site. The code shown in plain blocks is read-only; the runnable block is a JavaScript stand-in that imitates a script's logic on plain data.

Creative Cloud Libraries

Open Window > Libraries. A library stores colors, character styles, graphic styles, brushes, symbols, logos and images and syncs them through your Adobe account, so they are available in Illustrator, Photoshop and InDesign.

  • Click the + icon to add the selected object or color to a library.
  • Drag items from the panel onto the artboard. Graphics can be linked (editing the library asset updates the file) or embedded (Add a copy).
  • Share a library with teammates (it asks for their accounts) with edit or view rights.

Libraries fit brand kits: colors, type styles and logo files in one place.

Other reuse tools

  • Swatches and Swatch Libraries (save with Save Swatch Library as AI/ASE).
  • Graphic Styles: see the Appearance panel.
  • Symbols: see symbols.
  • Templates: File > Save as Template saves a .ait file with your artboards, guides and swatches.
  • Workspaces: Window > Workspace > New Workspace saves panel layouts.

Actions

An action records a sequence of menu commands and replays it. Open Window > Actions.

  1. Click Create New Action, name it, and optionally assign a function key.
  2. Click Record.
  3. Perform the steps (for example, Select > All, Object > Path > Outline Stroke, Object > Expand).
  4. Click Stop.
  5. Play it on another file with Play.

Use Batch from the panel menu to run an action on every file in a folder, saving or closing each file, with a destination folder for the results.

Limitations: actions record menu commands, not every tool movement, and they cannot make decisions such as "if the shape is wider than 100 px". For logic, you need a script.

Image Trace

Window > Image Trace or Object > Image Trace > Make converts a raster image into vector paths. Presets include High Fidelity Photo, Low Fidelity Photo, Sketched Art, Black and White Logo and 6 Colors. Expand the result to edit paths. Always clean up the paths: trace results often have too many points, so use Object > Path > Simplify afterwards.

Scripting

Illustrator can be scripted with ExtendScript (JavaScript with Adobe's object model, files with the extension .jsx), AppleScript and VBScript. Put a script in the Scripts folder of the install, and it appears in File > Scripts; or choose File > Scripts > Other Script to run any file. The following is a typical shape of a script. It is read-only here because Illustrator is not available on this site.

JavaScript
// ExtendScript (read-only example: runs only inside Illustrator)
var doc = app.activeDocument;
for (var i = 0; i < doc.artboards.length; i++) {
  var board = doc.artboards[i];
  board.name = "icon-" + (i + 1);
}

Concepts:

  • app is the application; app.activeDocument the open file.
  • doc.artboards, doc.layers, doc.pathItems, doc.textFrames are collections you can loop over.
  • Many collections are indexed from 0 and can be addressed by name.
  • ExtendScript is based on an older JavaScript (ES3): no let, const or arrow functions; use var, and an array method such as forEach is missing in older versions.
  • Scripts can use File > Scripts UI dialogs, and run in the ExtendScript Toolkit replacement (the ExtendScript Debugger extension for VS Code). Newer versions also support UXP plugins and CEP panels for building extensions.

Always test a script on a copy of your file. A bug can rename or delete hundreds of objects, and scripted changes can be hard to undo.

Stand-in: rename artboards with logic

This is the logic of a renaming script, written in modern JavaScript and applied to plain data, so you can test it here before translating it to ExtendScript.

JS Stand-in: batch-rename artboards

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The branch on size shows what an action cannot do: choose a name depending on the object.

Stand-in: a script's audit report

JS Stand-in: audit a document model

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Where to learn more

Adobe's scripting guide and object model reference describe every property. Many designers also use community scripts for tasks like randomizing colors or exporting artboards. Treat downloaded scripts as code: read them before running, because they can edit and write files.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What can a script do that an action cannot?

    Scripts have programming logic. Actions replay recorded steps.
  2. 2. What file extension do ExtendScript files commonly use?

    .jsx is the usual extension for ExtendScript.
  3. 3. Which panel syncs colors, styles and logos across Adobe apps?

    CC Libraries sync through your Adobe account.
  4. 4. Why should you test scripts on a copy?

    Automation multiplies mistakes as well as speed.

Summary

  • Libraries, swatches, styles, symbols and templates reuse assets.
  • Actions record menu commands and can run in batches; scripts add logic using ExtendScript.
  • Image Trace converts raster images to vector; clean up the result.
  • The JavaScript in runnable blocks is a stand-in for script logic, not Illustrator.

Next: Project: A Brand Identity Sheet