3 Replies Latest reply on Aug 10, 2010 8:50 AM by Muppet Mark-QAl63s

    Load selection


      A nice easy one for someone I'm sure...


      I've got a document with two layers. One layer is an image which fills the entire documeent. The other layer is just a stroke border.


      In vbscript how do I select just the border, without selecting the whole document?


      I'm sure it's fairly straight forward but haven't figured it out yet :-(



      Thanks for any help.

        • 1. Re: Load selection
          Muppet Mark-QAl63s Level 4

          If Im understanding you correctly then you are wanting to load selection from a layers transparency? Like command clicking in the layer's icon… The load selection in the DOM is from saved alpha channels so you will need to use scriptlistener to do this… This is made from the Plug-In's output but you should be able to call this from VB? Not sure if the Plug-In can output VB for you on a PC? I know it don't do AppleScript on Mac… Anyhow…


          #target photoshop
          var docRef = app.activeDocument;
          docRef.activeLayer = docRef.layers[0]; 
          function selLayerTrans() {
               function cTID(s) { return app.charIDToTypeID(s); };
               function sTID(s) { return app.stringIDToTypeID(s); };
                    var desc01 = new ActionDescriptor();
                    var ref1 = new ActionReference();
                    ref1.putProperty( cTID('Chnl'), cTID('fsel') );
                    desc01.putReference( cTID('null'), ref1 );
                    var ref2 = new ActionReference();
                    ref2.putEnumerated( cTID('Chnl'), cTID('Chnl'), cTID('Trsp') );
                    desc01.putReference( cTID('T   '), ref2 );
               executeAction( cTID('setd'), desc01, DialogModes.NO );

          • 2. Re: Load selection
            Col84 Level 1

            Thanks for that.


            Basically what I was trying to do was load the selection of the stroke border onto the background image, if that makes sense?


            I think I was going about it a long way round though because it was only a simple straight 10px border. I've now got rid of the stroke border layer and just made the selection directly onto the original image...


            ShapeRef = Array(Array(10, 10), Array(10, 590), Array(590,590), Array(590,10))
            newDocRef.Selection.Select ShapeRef



            Just another question while I'm here, I presume layer styles such as shadow, glow, bevel etc can only be done through script listener?



            Thanks again,


            • 3. Re: Load selection
              Muppet Mark-QAl63s Level 4

              I would apply these thru scriptlistener output but it might be possible with presets… The others here will let you know if that is possible? You are NOT going to be able to do this the way that you plan (or at least I don't think so). For a layer style to work it must NOT be background layer also your selection will be ignored if you apply a style?