Mobile app version of vmapp.org
Login or Join
Eichhorn212

: 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

@Eichhorn212

Posted in: #AdobeIllustrator #Artboard #IllustratorScripting

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Eichhorn212

1 Comments

Sorted by latest first Latest Oldest Best

 

@Caterina889

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);

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme