Hi guys, after recent user request for help with this much discussed Ruler Origin, and after Jacob having to explain how to do it modifying the user prefs, and after Wade having to explain where to find the file, I wrote a script that does all that for us. It moves the ruler origin to bottom/left or top/left on demand, without having to restart Illustrator. The change is global and permanent (until changed back). After running the script, double-click on the top/left corner of the document, where the rulers meet, to update rulers on active documents.
#target Illustrator
// script.name = switchRulerOriginToCS4nCS5.jsx;
// script.description = switches ruler origin to bottom/left (like CS4), and back to top/left (like CS5);
// script.required = runs on CS5 only;
// script.parent = carlos canto // 8/12/11;
// script.elegant = false;
var appver = Number(String(app.version).split(".")[0]);
if (appver >= 15)
{
//var idoc = app.activeDocument;
var win = new Window("dialog","Set Coordinate System");
var grpCoordinates = win.add("group");
var grpCS4 = grpCoordinates.add("group");
var lblCS4dummy = grpCS4.add("statictext",undefined,"CS4");
var panely1 = grpCS4.add("panel");
var lblCS4 = grpCS4.add("statictext",undefined,"CS4");
var panelx = grpCoordinates.add("panel");
var grpCS5 = grpCoordinates.add("group");
var lblCS5dummy = grpCS5.add("statictext",undefined,"CS5");
var panely2 = grpCS5.add("panel");
var lblCS5 = grpCS5.add("statictext",undefined,"CS5");
grpCoordinates.orientation = "column";
lblCS4dummy.visible = lblCS5dummy.visible = false;
var panelradio = win.add("panel", undefined, "Ruler Origin as in...");
panely1.bounds = {x:0, y:0, width:0, height:60};
panelx.bounds = {x:0, y:0, width:120, height:0};
panely2.bounds = {x:0, y:0, width:0, height:60};
grpCoordinates.spacing = 0;
win.helpTip = grpCoordinates.helpTip = "Double-Click where the rulers meet to update \rCurrent Doc's Ruler Origin...";
grpCoordinates.helpTip = "Coded by CarlosCanto";
grpCS4.helpTip = "CS4: Positive Y moving up";
grpCS5.helpTip = "CS5: Positive Y moving down";
lblCS4.helpTip = lblCS5.helpTip = "Don't click me...";
//add Radio buttons
var grpRadio = panelradio.add("group");
var radCS4 = grpRadio.add("radiobutton",undefined,"CS4");
var radCS5 = grpRadio.add("radiobutton",undefined,"CS5");
var btnOk = grpRadio.add("button", undefined, "Ok");
btnOk.size = [40,25];
btnOk.enabled = false;
//radCenter.value = true;
win.defaultElement = lblCS4dummy; // make this element default to prevent hitting "enter" to trigger ok button
radCS4.onClick = function(){
// alert(idoc.name);
lblCS4.visible = true;
lblCS5.visible = false;
btnOk.enabled = true;
}
radCS5.onClick = function(){
//alert(idoc.name);
lblCS4.visible = false;
lblCS5.visible = true;
btnOk.enabled = true;
}
btnOk.onClick = function(){
//alert(radCS5.value);
app.preferences.setBooleanPreference ("isRulerOriginTopLeft",radCS5.value);
app.preferences.setBooleanPreference ("isRulerIn4thQuad",radCS5.value);
win.close();
}
lblCS4.onClick = lblCS5.onClick = function(){
alert("...we're so damn curious, aren't we?");
}
win.center();
win.show();
}
else
{
alert("CS4 and earlier don't need this trick...good bye.")
}
thanks Scott,
thanks Wade,
no problem, I didn't come up with the solution though, I just made it easy to get implemented. I don't know who posted it first, to give proper credits, Jacob posts it everytime a user ask for it.
I have no idea how to post on exchange, is it the place where it takes ages to get approved before something gets posted? according to some users.
Very nice work, Carlos.
The first presentation of the solution that I have seen in the forum was by moluapple, in post #16, here:
http://forums.adobe.com/message/3859580?tstart=30#3859580
It was a great relief to have the solution, as it appears from that thread, and from the other threads I referred to along with it just a few days ago, in post #6 here:
http://forums.adobe.com/message/3859580?tstart=30#3859580
Now there is a much easier way.
Thank you very much.
Thank you so much for this script, as a mechanical designer where the bottom left is always the origin this was driving me crazy!
I understand that their may be some precident for other origins, but it was ill advised for Adobe to not have an option for setting the origin.
Thanks for adding what Adobe should have.
North America
Europe, Middle East and Africa
Asia Pacific