2 Replies Latest reply on Feb 19, 2008 10:29 AM by (Rosta_Vanek)

    SHOW / HIDE RULERS script

    Level 1
      hi iam only starting with scripting

      i want a script that will hide rulers IF THEY ARE VISIBLE
      if they are already hidden (CTRL+R) it should just skip over...

      i have this simple script:

      app.panels.everyItem().visible = false; //hides all palettes
      app.activeWindow.zoomPercentage= 131 //sets window zoom to 131% which is around 1:1 zoom with real size ruler in my screen resolution
      app.activeWindow.maximize() //maximize window to get a full screen presentation view
      app.activeWindow.maximize() //again maximizes in case the last command just restored the window instead of fully maximizing...

      its not perfect at all but does the job of switching into 1:1 real size zoom and displaying full screen presentation of the page...

      now i need to add a line that will also hide rulers if they are visible but if they happen to be hiden already at that time it should do nothing...

      i managed to come up with something like this:
      var myMenuAction = app.menuActions.item("$ID/Hide rulers");

      which works only ONE WAY when the rulers are visible but throws an error when the rulers are already hidden... thats because the menu item is switchable (HIDE RULERS / SHOW RULERS)
        • 1. Re: SHOW / HIDE RULERS script
          [Jongware] Most Valuable Participant
          Hi Rosta,

          I had to cheat :-) I have a plain text editor which can also search in files. Let it loose on my html, and it came up with this: ViewPreference!

          This is an element of both Application and Document (so you can set it worldwide, or per doc), and has a property "showRulers -- bool -- r/w -- If true, displays the horizontal and vertical rulers."
          • 2. Re: SHOW / HIDE RULERS script
            Level 1
            LOL MAN thats hillarious... nice job

            as if i wasn't just babbling about it whole day...

            iam sorry to say it becuase i respect guys like Olav but the biggest obstacle in learning JS in CS3 is its poor object model documentation... and tools like ExtendScript2 doesnt help a bit... when i type "Rulers" in find field of Object Model Viewer it shows two misserable entries...

            only when i specifically (thanks to you) KNOW IAM LOKING for "showRulers" entry ExtendScript2 will find the term for me... but thats ridicullous i dont need a find function which doesnt look around the corner...

            NEVERMIND THANKS FOR YOUR TIP "showRulers -- bool -- r/w -- If true, displays the horizontal and vertical rulers." IS WHAT I WAS HOPELESSLY LOKING FOR...