: Set active artboard by name in illustrator? There is getActiveArtboardIndex and setActiveArtboardIndex, I can get the Artboard object with getByName. But how do I set active artboard by name? Or
There is getActiveArtboardIndex and setActiveArtboardIndex, I can get the Artboard object with getByName.
But how do I set active artboard by name?
Or at least get index from the Artboard object?
More posts by @Eichhorn212
1 Comments
Sorted by latest first Latest Oldest Best
Not the most elegant way, but still solves the problem:
var docRef = app.activeDocument;
var ABName = "Artboard Name";
function setActiveArtboardBy(name) {
var artboard = docRef.artboards.getByName(name);
for (i = 0; i < docRef.artboards.length; i++) {
if (docRef.artboards[i] == artboard) {
docRef.artboards.setActiveArtboardIndex(i);
break;
}
}
}
setActiveArtboardBy(ABName);
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.