The current Illustrator API doesn’t allow you to work with all the strokes and fills added to an object as with arrays. Similar to one active layer, the Illustrator API defines one active stroke and fill. We see their contents in the Color, Stroke, and other panels. You activate them manually in the Appearance panel. The active status indicator is an additional pixel frame around the color square.

The current Illustrator API doesn’t allow you to work with all the strokes and fills added to an object as with arrays. Similar to one active layer, the Illustrator API defines one active stroke and fill. We see their contents in the Color, Stroke, and other panels. You activate them manually in the Appearance panel. The active status indicator is an additional pixel frame around the color square.

Changing each stroke and fill by a script at a time

--

--

The artboards.setActiveArtboardIndex(index) method makes the specified artboard active in the document and available for operations in the script. The user identifies the active artboard in Illustrator by:

  • black pixel frame,
  • highlighted in the Artboards panel,
  • Artboard Tool (Shift+O) shows the artboard name in the Control panel.

Running setActiveArtboardIndex has an interface bug: the active artboard gets a black border, but the highlighting and name do not change.

Part of the interface is not updated

The app.redraw() command or reopening the Artboards panel by calling app.executeMenuCommand(‘Adobe Artboard Palette’) twice will not reset this interface bug. But fortunately, the scripts continue to work without error.

Illustrator CS5/CS6 users report that in them, the active artboard highlighting changes after the script runs.

--

--

The app.activeDocument.swatches.getSelected() method gets an array of selected colors in the Swatches panel of the document. What happens when you apply colors from the array to selected objects? If you select one path in the document and apply a color to it, all swatches remain selected.

Applying colors to one selected path

If many paths are selected, applying a swatch to any path resets the color selection. If you create a script to paint objects with selected colors, it makes the user’s job more difficult. To run the script again, the user has to select the swatches again.

--

--

AiScripts

Sergey Osokin. I’m a illustrator & Script Developer (Ai, Ps). Writing about bugs and tricks.