Skip navigation
Currently Being Moderated

JS - change CS5 Ruler Origin to bottom/left (like CS4)

Aug 12, 2011 6:50 PM

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
// = 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(;
            lblCS4.visible = true;
            lblCS5.visible = false;
            btnOk.enabled = true;
        radCS5.onClick = function(){
            lblCS4.visible = false;
            lblCS5.visible = true;
            btnOk.enabled = true;
        btnOk.onClick = function(){
            app.preferences.setBooleanPreference ("isRulerOriginTopLeft",radCS5.value);
            app.preferences.setBooleanPreference ("isRulerIn4thQuad",radCS5.value);            
        lblCS4.onClick = lblCS5.onClick = function(){
        alert("...we're so damn curious, aren't we?");
        alert("CS4 and earlier don't need this trick...good bye.")
  • Currently Being Moderated
    Aug 12, 2011 7:10 PM   in reply to CarlosCanto

    Very nice Carlos! Thanks!

    Mark as:
  • Currently Being Moderated
    Aug 12, 2011 8:32 PM   in reply to [scott w]

    That is really excellent and i think Adobe should be told about the script and it should posted on Adobe Exchange with credit to Carlos.


    Thanks Carlos.




    P.S. I hope you don't mind Carlos but I brought it to the attention of someone that has contact with Adobe.

    Mark as:
  • Currently Being Moderated
    Aug 15, 2011 2:54 PM   in reply to CarlosCanto

    Very nice work, Carlos.


    The first presentation of the solution that I have seen in the forum was by moluapple, in post #16, here:


    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:



    Now there is a much easier way.


    Thank you very much.

    Mark as:
  • Currently Being Moderated
    Aug 24, 2011 10:28 AM   in reply to CarlosCanto

    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.

    Mark as:
  • Currently Being Moderated
    Feb 22, 2013 10:46 AM   in reply to CarlosCanto

    Neither the script nor the Prefs file change seem to work with CS6 version 16.0.4. I'd be interested to know if this is just me or whether the recent update broke the script.

    Mark as:
  • Currently Being Moderated
    Sep 3, 2013 2:30 PM   in reply to phunkidude

    Hi there phunkidude, I see your comment is from months ago but, I searched for a solution to this vexing issue only today, even though it's been bugging me for months. I am on CS6 16.0.4, Mac platform and it did work for me.


    Copy the script from above. Open ExtendScript, create a new file and paste the code into the window of the app. Save as 'whatever-name-you-prefer.jsx' on your Desktop, or somewhere else you can easily find the file. (ExtendScript is probably located here: Macintosh HD/Applications/Utilities/Adobe Utilities-CS6/ExtendScript Toolkit CS6) Not sure where it's located on a Windows system.


    Open Illustrator. From Illustrator's Menu, select 'File/Scripts/Other Scripts...' then navigate to the .jsx file you just saved on your Desktop. Select the file and click "Open". The script will then run and you will see the little dialog box as shown above. If you want the XY origin at bottom-left, click the radio button for CS4. If you want things starting from top-left, select CS5.


    The interesting thing in this whole issue is that no one considered having this option included natively (I'm talking to you, Adobe!!) in the Workspace profile for Printing and Proofing or Illustration, and having the XY origin at left-top for Web, which would seemingly include any screen, (such as video) where your workflow includes those other apps such as Photoshop, Flash or Fireworks.

    Mark as:
  • Currently Being Moderated
    Sep 3, 2013 2:33 PM   in reply to CarlosCanto



    Such a terrific contribution! Danke schön!, muito obrigado, thank you very much!!!

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)