Copy link to clipboard
I have been trying to make a simple script that selects all elements on an artboard and makes a symbol with the name of the artboard. Unfortunately the symbols.add(selection) does not work. Can anyone give me a clue or solution.
One can't debug code that one can't see. Also, it would be helpful to show what you're trying to achieve with a screenshot.
You can try the following,
var doc = app.activeDocument;
var _activeAtboardName = doc.artboards[app.activeDocument.artboards.getActiveArtboardIndex()].name
var _symbol = doc.symbols.add(app.selection);
_symbol.name = _activeAtboardName;
app.selection, is an array, but symbols.add expect a single pageItem not an array, tehrefore, group all items before making symbol and after that ungroup it.