This script should make a rectangle the same size as the artboard.
However if the artboard is 210mm wide the rectangle ends up being 210.002mm, is there any way to make this more precise?
#target illustrator var docRef = app.activeDocument; var artboardRef = docRef.artboards; var activeAB = docRef.artboards[docRef.artboards.getActiveArtboardIndex()]; // get active AB //get artboard size var left = activeAB.artboardRect[0]; var top = activeAB.artboardRect[1] ; var width = activeAB.artboardRect[2]-activeAB.artboardRect[0]; var height = activeAB.artboardRect[1]-activeAB.artboardRect[3]; //create box var box = docRef.pathItems.rectangle (top, left, width, height); box.fillColor = box.strokeColor = new NoColor();