Illustrator Javascript to create rectangle the size of the artboard, then one 6mm less wide and tall
Hi there everyone!
I have managed to write a script to create a rectangle the size of whatever the artboard is, but I also need to create additional rectangles that are 6mm less wide and tall than the artboard, and then 12mm less wide and tall than the artboard.
My current script to do this is:
function createRectOnArtboard() { var doc = app.activeDocument; var artboard = doc.artboards[ doc.artboards.getActiveArtboardIndex() ]; var bounds = artboard.artboardRect; var rect = doc.pathItems.rectangle( bounds[0], bounds[1], bounds[2], bounds[3] * -1 ); rect.name = artboard.name; }; createRectOnArtboard();
I am not bothered if the solution is an addition/amendment to the above script, or completely entirely new code... just as long as I end up with 3 separate rectangles at artboard size, artboard size -6x-6, artboard size -12x-12.
Thank you so much in advance, and have a lovely week!
