6 Replies Latest reply: May 6, 2013 11:50 AM by Paul Riggott RSS

    Is it possible to show/hide guides via the csawlib or any other way?

    cameronmcefee Community Member

      Hello, in an upcoming update to GuideGuide I've moved nearly all my code into the panel and am relying heavily on the csawlib. Unfortunately, it seems that now when guides are added to the stage, if the user has not set guides to be visible, GuideGuide adds the guides but does not reveal them. This has resulted in a number of support tickets from people that assume GuideGuide is broken. I've been confused by it myself on many occasions.

       

       

      Is it possible to show/hide guides using the csawlib? I've searched through the docs but can't find anything that indicates it's possible.

       

       

      I've still got a .jsx file that gets embedded when the panel is compiled I use to get around the broken history suspension in the csawlib. I'd settle for a javascript solution if that's all there is. Looking through a list of values that charIDToTypeID accepts I've seen some guide related things, but so far the structure of that sort of code has been a bit incomprehensible.

        • 1. Re: Is it possible to show/hide guides via the csawlib or any other way?
          lijyang

          Hi,

          I cannot reproduced this issue using the follow steps:

          1. Disable Show > Guides.

          2. Try to show the added guides in Sets in GuideGuide extension.

          Results:

          Guides can be shown successfully.

           

          I don't know if the steps I used same with yours. If not, please privde your exactly steps; if so, please help to privde the version numbers of Extension builder, csawlib and Photoshop, and I will try to reproduce it again.

           

          Thanks a lot.

          • 2. Re: Is it possible to show/hide guides via the csawlib or any other way?
            cameronmcefee Community Member

            Hi lijyang,

             

            The issue exists in the current beta of GuideGuide. To install, open up your current GuideGuide panel, and choose "modify settings" from the flyout menu. Change the update channel to "beta". Confirm the settings change, then have GuideGuide check for updates. After a short wait you'll be prompted to open and close the panel, which will update to the beta.

             

            At that point:

             

            1. Disable Show > Guides

            2. If you've been testing, clear the guides: View > Clear Guides

            3. Run a GuideGuide set.

             

            Expected:

            Guides appear

             

            Actual:

            Guides are created, but still hidden. Enabling Show > Guides reveals the new guides.

             

            Presumption:

            When using the csawlib to add guides, guides are added without consideration of guide visibility.

             

            Desired:

            Code to toggle Show > Guides. Something

             

            For reference, the code being executed:

             

                      var originalUnits:Units = PHOTOSHOP.preferences.rulerUnits

                      PHOTOSHOP.preferences.rulerUnits = Units.PIXELS

             

                      var i:Number = 0;

                      var doc:Document = PHOTOSHOP.activeDocument

                      var u:Object

             

                      for(i=0;i<params.horzGuides.length;i++){

                        u = params.horzGuides[i] + " px" as Object

                        doc.guides.add(Direction.HORIZONTAL,u)

                      }

                      for(i=0;i<params.vertGuides.length;i++){

                        u = params.vertGuides[i] + " px" as Object

                        doc.guides.add(Direction.VERTICAL,u)

                      }

             

                      PHOTOSHOP.preferences.rulerUnits = originalUnits


            • 3. Re: Is it possible to show/hide guides via the csawlib or any other way?
              lijyang Community Member

              Hi cameronmcefee,

              Thanks for your reply, and issue can be reproduced with your detailed steps.

              • 4. Re: Is it possible to show/hide guides via the csawlib or any other way?
                Paul Riggott Community Member

                The problem is that you are using the new system to add guides, if you used the old action manager guides will be shown when a new guide is added....

                 

                 

                //This will not show if guides are hidden.
                activeDocument.guides.add(Direction.HORIZONTAL,new UnitValue(250,'px'));
                
                //these will.. 
                //guideLine(300,"Hrzn");
                //guideLine(300,"Vrtc");
                
                function guideLine(position, type){
                    var desc27 = new ActionDescriptor();
                        var desc28 = new ActionDescriptor();
                        desc28.putUnitDouble( app.charIDToTypeID('Pstn'), app.charIDToTypeID('#Pxl'), position );
                        desc28.putEnumerated( app.charIDToTypeID('Ornt'), app.charIDToTypeID('Ornt'), app.charIDToTypeID(type) );
                    desc27.putObject( app.charIDToTypeID('Nw  '), app.charIDToTypeID('Gd  '), desc28 );
                    executeAction( app.charIDToTypeID('Mk  '), desc27, DialogModes.NO );
                };
                
                • 5. Re: Is it possible to show/hide guides via the csawlib or any other way?
                  cameronmcefee Community Member

                  That's unfortunate, I was hoping it wouldn't be the case. Thanks for confirming though.

                  • 6. Re: Is it possible to show/hide guides via the csawlib or any other way?
                    Paul Riggott Community Member

                    I think this could be classed as a bug as if a new guide is created in Photoshop the other guides will show if they were hidden.