5 Replies Latest reply on Jan 8, 2017 9:03 PM by JJMack

    How to Select CTRL + Click command

    Dariusz1989 Level 1

      Hey

      Frustrating but I cant find it...

       

      I know there is selection.selectAll but I want to select only pixels in channel so... :

       

      doc.ActiveChannel.select.select < ??

      or

      doc.channel[5].select.select ??

       

      basically select pixels and then fill layer using selection

       

      Regards

      Dariusz

        • 1. Re: How to Select CTRL + Click command
          JJMack Most Valuable Participant

          You can load a channel as a selection usinak acyion manager code.  I would also think you coul also add to the selecton by adding accitional channels to the selection.  The Acyion managet load may look something like this:

           

          // ======Load Alpha Channel Selection===============================

          function loadAlpha(channel) {

            var idsetd = charIDToTypeID( "setd" );

               var desc2 = new ActionDescriptor();

               var idnull = charIDToTypeID( "null" );

                   var ref1 = new ActionReference();

                   var idChnl = charIDToTypeID( "Chnl" );

                   var idfsel = charIDToTypeID( "fsel" );

                   ref1.putProperty( idChnl, idfsel );

               desc2.putReference( idnull, ref1 );

               var idT = charIDToTypeID( "T   " );

                   var ref2 = new ActionReference();

                   var idChnl = charIDToTypeID( "Chnl" );

                   ref2.putName( idChnl, channel );

               desc2.putReference( idT, ref2 );

            executeAction( idsetd, desc2, DialogModes.NO );

          }

          • 2. Re: How to Select CTRL + Click command
            Dariusz1989 Level 1

            Hey

            Yeah I know, but I was hoping I could do something like

             

            selectionR = doc.channel[1].select.loadSelection()

            selectionG = doc.channel[2].select.loadSelection()

            selectionB = doc.channel[3].select.loadSelection()

             

            do stuff with selectionR etc etc. So I can go back to it at will...

            • 3. Re: How to Select CTRL + Click command
              JJMack Most Valuable Participant

              Also DOM Selection method:

               

              load (from[, combination][, inverting]) Channel. SelectionType boolean

              Loads the selection from the specified channel.

               

              var channelRef = app.activeDocument.channels.getByName("my channel");

               

              SelectionType DIMINISH or EXTEND or INTERSECT or REPLACE

              The selection behavior when a selection already exists:

              DIMINISH: Remove the selection from the already selected area.

              EXTEND: Add the selection to an already selected area.

              INTERSECT: Make the selection only the area where the new selection intersects the already selected area.

              REPLACE: Replace the selected area.

              Used in PathItem.makeSelection(),

              Selection.load(), Selection.select(), and  Selection.store().

              • 4. Re: How to Select CTRL + Click command
                Dariusz1989 Level 1

                I have no idea how to use it o.o

                 

                Can you throw an example maybe?

                 

                Btw thanks for help, many of your posts that I read helped me a lot in past!

                • 5. Re: How to Select CTRL + Click command
                  JJMack Most Valuable Participant

                  I use the Action manager code I posted to load the Alpha channels I have in collage template PSD the Map the Shape Size and image location on image in collages.  The Alpha channels must have the required names.  :"mage 1",  "Image 2", ..., "Image N"

                   

                  I use the function I posted above. To load the Alpha Channels so I can size position and mask image layers to shape.

                   

                  loadAlpha("Image " + imageNumber);