8 Replies Latest reply on Jan 7, 2015 7:44 AM by JJMack

    Move specific path to the top of path palette

    Beracah SB Level 1

      Please help with any script or any photoshop options to move the path to first of path palette.

       

      Example:

      If a path palette has 6 paths, I need a path named "Shine" need to move to the first of stack.

       

      Screen grab shown below for better understanding.

      path.jpg

        • 1. Re: Move specific path to the top of path palette
          JJMack Most Valuable Participant

          It can be done with Action Manager code recorded bt the scriptlistener plug-in.  Here the First step targeted(selected) a path named "Path 3" the second step moved the targeted path to the top of the palette.   Why do you want to do that though?

           

          / =======================================================

          var idslct = charIDToTypeID( "slct" );

              var desc24 = new ActionDescriptor();

              var idnull = charIDToTypeID( "null" );

                  var ref22 = new ActionReference();

                  var idPath = charIDToTypeID( "Path" );

                  ref22.putName( idPath, "Path 3" );   <--------------------------------------------------------- Path 3

              desc24.putReference( idnull, ref22 );

          executeAction( idslct, desc24, DialogModes.NO );

           

           

          // =======================================================

          var idmove = charIDToTypeID( "move" );

              var desc25 = new ActionDescriptor();

              var idnull = charIDToTypeID( "null" );

                  var ref23 = new ActionReference();

                  var idPath = charIDToTypeID( "Path" );

                  var idOrdn = charIDToTypeID( "Ordn" );

                  var idTrgt = charIDToTypeID( "Trgt" );

                  ref23.putEnumerated( idPath, idOrdn, idTrgt );

              desc25.putReference( idnull, ref23 );

              var idT = charIDToTypeID( "T   " );

                  var ref24 = new ActionReference();

                  var idindx = charIDToTypeID( "indx" );

                  ref24.putIndex( idindx, 0 );  <------------------------------------------------ index 0 top of the palette

              desc25.putReference( idT, ref24 );

          executeAction( idmove, desc25, DialogModes.NO );

          • 2. Re: Move specific path to the top of path palette
            Beracah SB Level 1

            Hi Mack,

             

            I am getting an error message at the last line "executeAction( idmove, desc25, DialogModes.NO );" -- error message :"General Photoshop error occurs. This functionality may not be available in the version of photoshop".

             

            Hope you have applied the channel mask script for the path (good try).

            • 3. Re: Move specific path to the top of path palette
              JJMack Most Valuable Participant

              Shine_RRD wrote:

               

              Hope you have applied the channel mask script for the path (good try).

              ??? What channel mask script the first mention of such a script is your  Reply  stating the scriptlistener code I posted does not work.  I can understand it not  working  the document you use it on did not have several paths which included one with the name  "Path 3"   If the document has the required paths it should work.  The script would of course be better if you search the documents path to see if it has a "Path 3".

               

              Page 135 Photoshop javascript get it by name useing Photoshop DOM interface and select it if found

               

              PathItem

              A path or drawing object, such as the outline of a shape or a straight or curved line, which contains sub

              paths that define its geometry.

              Access through the collection in the Document.pathItems property. For example, this selects a named

              path item:

              var currentPathItem = app.activeDocument.pathItems.getByName("myPath");

              currentPathItem.select()

              Create these objects by passing a set of SubPathInfo objects to the PathItems.add() method. This method

              creates a SubPathItem object for each SubPathInfo object, and creates and returns a new PathItem object

              for the path represented by all of the subpaths.

               

               

              Capture.jpg

              • 4. Re: Re: Move specific path to the top of path palette
                pixxxel schubser MVP & Adobe Community Professional

                Hi JJMack,

                sorry but it is so, like Shine_RRD said.

                The path will be selected and then the script fails.

                 

                The AM-Code doesn't work in PS CS3 and not in PS CS5.

                PS_PathMove2.png

                PS_PathMove1.png

                • 5. Re: Move specific path to the top of path palette
                  Pedro Cortez Marques Level 3

                  It checks if Path name exists and if so, select it and move it to top

                  executeAction will not send error.

                   

                  myPathNameToTop('Shine');

                   

                   

                  function myPathNameToTop(name) {

                      $.level =0; // only if you are using this from ESTK (it can be removed when running from photoshop)

                      try {

                          var myPath = app.activeDocument.pathItems.getByName (name);

                      } catch(e) {}

                      $.level =1;

                      if (String(myPath) != "undefined") { // if exists move to top

                          myPath.select();

                          var desc25 = new ActionDescriptor();

                          var ref23 = new ActionReference();

                          ref23.putEnumerated( charIDToTypeID( "Path" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );

                          desc25.putReference( charIDToTypeID( "null" ), ref23 );

                          var ref24 = new ActionReference();

                          ref24.putIndex( charIDToTypeID( "indx" ), 0 );

                          desc25.putReference( charIDToTypeID( "T   " ), ref24 );

                          executeAction( charIDToTypeID( "move" ), desc25, DialogModes.NO );

                      }

                  }

                  • 6. Re: Move specific path to the top of path palette
                    pixxxel schubser MVP & Adobe Community Professional

                    Hi PedroCortezMarques,

                    same result here with your code - does not work with CS3 and not with CS5 (see the screenshot in my last posting)

                     

                    What versions of Photoshop do you use?

                     

                    (only as note: my ScriptingListener does not record any code for moving paths)

                    • 8. Re: Re: Move specific path to the top of path palette
                      JJMack Most Valuable Participant

                      Photoshop changes over time.  Photoshop Scripting Document Object Model does not enable  you to script all of Photoshop operations. This is also true for Actions only some Photoshop operations are recordable.  However more Photoshop operation can be recorded in Photoshop Actions then can be programed with Photoshop Scripting DOM. Recent Photoshop versions add an option to also record tool operation like brush strokes. 

                       

                      Adobe Provides a Plug-in Scriptlistener that will record what can be recorded in Photoshop in action in scripting code to be use with a special interface to the Action Manager.  However the Scriptlistener Pug-in will disable tools recording scripting tool recording is not possible.

                       

                      What can be recorded over time changes.  Operations that may be recorded in CC may not be recordable in CS6.  The Action Manager and Scriptlistener changes with versions of Photoshop.  In Fact the Scriptlistener plugin. That Adobe packaged with the repackaging of CS2 does not even work with the version of Photoshop.

                       

                      When you look a Adobe Photoshop Scripting DOM you can see you can Program some of Photoshop Path operation like selecting a path by name, Creating paths and other path operations.  However there is no method to Move path in the Path stack.

                       

                      When I see some operation that can not be scripted using DOM the first thing I do is can it be recorded by Scriptlistener.  In this case SciriptListener CC 2014 could and the code also works with Photoshop CC however it does not work in CS6.

                       

                      When I try to record the move operation in CS6 nothing is recorded.  CS6 Action Manager has no move path interface so it just like DOM the operation can not be automated prior to Photoshop version CC.