#target illustrator // Rotate Again - repeats the last rotation made with RotateAboutPoint.jsx // (same angle, same centre point, same Copy setting) without opening a dialog. (function () { if (app.documents.length === 0) { alert("Open a document first."); return; } var doc = app.activeDocument; if (!doc.selection || doc.selection.length === 0) { alert("Select one or more objects first."); return; } var f = new File(Folder.userData + "/RotateAboutPoint_last.txt"); if (!f.exists) { alert("No previous rotation found.\nRun RotateAboutPoint first."); return; } f.open("r"); var parts = f.read().split("|"); f.close(); var angle = parseFloat(parts[0]); var x = parseFloat(parts[1]); var y = parseFloat(parts[2]); var copy = parts[3] === "1"; if (isNaN(angle) || isNaN(x) || isNaN(y)) { alert("Saved settings are invalid."); return; } var prevCS = app.coordinateSystem; app.coordinateSystem = CoordinateSystem.DOCUMENTCOORDINATESYSTEM; try { var m = app.getTranslationMatrix(-x, -y); m = app.concatenateRotationMatrix(m, angle); m = app.concatenateTranslationMatrix(m, x, y); var sel = doc.selection, items = []; for (var i = 0; i < sel.length; i++) items.push(sel[i]); for (var j = 0; j < items.length; j++) { var t = copy ? items[j].duplicate() : items[j]; t.transform(m, true, true, true, true, true, Transformation.DOCUMENTORIGIN); } app.redraw(); } finally { app.coordinateSystem = prevCS; } })();