Copy link to clipboard
Copied
I'm currently working on a complex Action in Illustrator that segments a print file in a specific way. There are a handful of scripts that I found online that the action runs in order to achieve some things actions aren't currently capable of. One of the scripts I found creates a rectangle sized and positioned for each Artboard within my Document. This nearly fits my needs, but I would like to alter the script so that it only creates a rectangle for the Active Artboard. I tried altering the script myself, but I have basically no idea what I'm doing and all of the attempts I've made to change it have resulted with errors. Could someone with more scripting knowledge possibly tell me if it can be altered to fit my needs, and how to do so. Would be greatly appreciated. Here's the script in question.
#target illustrator
var docRef = app.activeDocument;
var artboardRef = docRef.artboards;
for(i=0;i<artboardRef.length;i++){
var top=artboardRef[i].artboardRect[1];
var left=artboardRef[i].artboardRect[0];
var width=artboardRef[i].artboardRect[2]-artboardRef[i].artboardRect[0];
var height=artboardRef[i].artboardRect[1]-artboardRef[i].artboardRect[3];
var rect = docRef.pathItems.rectangle (top, left, width, height);
rect.fillColor = rect.strokeColor = new NoColor();
}
Bonjour!
var docRef = app.activeDocument;
var idx = docRef.artboards.getActiveArtboardIndex();
var ab = docRef.artboards[idx];
var rect = ab.artboardRect;
app.defaultStroked = true;
app.defaultFilled = true;
var cadre = docRef.pathItems.rectangle(rect[1],rect[0],rect[2]-rect[0],rect[1]-rect[3]);
Copy link to clipboard
Copied
Bonjour!
var docRef = app.activeDocument;
var idx = docRef.artboards.getActiveArtboardIndex();
var ab = docRef.artboards[idx];
var rect = ab.artboardRect;
app.defaultStroked = true;
app.defaultFilled = true;
var cadre = docRef.pathItems.rectangle(rect[1],rect[0],rect[2]-rect[0],rect[1]-rect[3]);
Copy link to clipboard
Copied
Merci! That worked beautifully, thanks so much for your help!