Skip to main content
Inspiring
January 14, 2022
Question

Script to Rotate Artboard by entered amount?

  • January 14, 2022
  • 1 reply
  • 504 views

I'm not sure if theres a script i couldnt find one where you enter your amount to rotate. I'm looking for the script to look something like the attached file. And i'd like to be able to select via check box (IF POSSIBLE) to make it work for Active document or All open documents.

This topic has been closed for replies.

1 reply

Charu Rajput
Community Expert
Community Expert
January 14, 2022

Hi,

You want to rotate the artboard or resize the artboard?

 

Best regards
cbishop01Author
Inspiring
January 21, 2022

Sorry it took so long to reply works been busy..  No i just want it to rotate the artboard I just grabbed a script that was for resizing the artboard for reference.. All i need it a text field or soemthing i can enter % to rotate if possible if thats crazy difficult just something that rotates 0, 90, 180, 360 will work.

thank you..

femkeblanco
Legend
January 21, 2022

This should rotate the artboard and artwork ±90, 180, 270 or 360° (any other number will cause an error):

var groups = app.activeDocument.groupItems;
var d = app.activeDocument.artboards[0].artboardRect;
rect1 = app.activeDocument.pathItems.rectangle(d[1], d[0], d[2], -d[3]);
app.executeMenuCommand("selectall");
app.executeMenuCommand("group");
groups[0].rotate(-Number(prompt("Enter ±90, 180, 270 or 360.")));
app.executeMenuCommand("deselectall");
rect1.selected = true;
app.executeMenuCommand("setCropMarks");
app.activeDocument.artboards[0].remove();
app.executeMenuCommand("selectall");
app.executeMenuCommand("ungroup");
app.executeMenuCommand("deselectall");