8 Replies Latest reply on Jan 20, 2017 11:20 PM by AndreyLarush

    Tell me how to work with layer masks in the CC2015 (better at DOM)

    AndreyLarush Level 1

      hi all !

      After installing CC 2015 has stopped working a few scripts. Most need the script to insert the images selected in the Bridge, in the layer with mask.After analyzing the script found a problem - Action-script works in Extend script tool, but doesn't work in html panel. Recorded new script again with the same result - the photo is inserted, resized but is not applied to the mask from the layer. Tell me where to be picked ?

      Thanks

        • 1. Re: Tell me how to work with layer masks in the CC2015 (better at DOM)
          JJMack Most Valuable Participant

          Supply pertinent information for quicker answers

          • The more information you supply about your situation, the better equipped other community members will be to answer. Consider including the following in your question:
          • Adobe product and version number
          • Operating system and version number
          • The full text of any error message(s)
          • What you were doing when the problem occurred
          • Flash support was removed from photoshop extensions are you using Flash Action-Script
          • Use html support
          • Post the Script Code
          • show what it does wrong
          • 2. Re: Tell me how to work with layer masks in the CC2015 (better at DOM)
            AndreyLarush Level 1

            Thanks :-)

            - Adobe Photoshop CC 2015

            - Windows 10,  64 bit

            - When script is worked in html panel, it`s dont send error.

            //-------------------------------------------------

            var idMk = charIDToTypeID( "Mk  " );

                var desc13 = new ActionDescriptor();

                var idNw = charIDToTypeID( "Nw  " );

                var idChnl = charIDToTypeID( "Chnl" );

                desc13.putClass( idNw, idChnl );

                var idAt = charIDToTypeID( "At  " );

                    var ref10 = new ActionReference();

                    var idChnl = charIDToTypeID( "Chnl" );

                    var idChnl = charIDToTypeID( "Chnl" );

                    var idMsk = charIDToTypeID( "Msk " );

                    ref10.putEnumerated( idChnl, idChnl, idMsk );

                    var idLyr = charIDToTypeID( "Lyr " );

                    ref10.putName( idLyr, "IMG_7032" );

                desc13.putReference( idAt, ref10 );

                var idUsng = charIDToTypeID( "Usng" );

                    var ref11 = new ActionReference();

                    var idChnl = charIDToTypeID( "Chnl" );

                    var idChnl = charIDToTypeID( "Chnl" );

                    var idMsk = charIDToTypeID( "Msk " );

                    ref11.putEnumerated( idChnl, idChnl, idMsk );

                    var idLyr = charIDToTypeID( "Lyr " );

                    var idOrdn = charIDToTypeID( "Ordn" );

                    var idTrgt = charIDToTypeID( "Trgt" );

                    ref11.putEnumerated( idLyr, idOrdn, idTrgt );

                desc13.putReference( idUsng, ref11 );

                var idDplc = charIDToTypeID( "Dplc" );

                desc13.putBoolean( idDplc, true );

                alert('OK')

            executeAction( idMk, desc13, DialogModes.NO );

                alert(1) // this alert is not show !!!!

             

            And second questen - How don`t linked real name for exampel layers (selected italic font) ?

            • 3. Re: Tell me how to work with layer masks in the CC2015 (better at DOM)
              JJMack Most Valuable Participant

              Before asking any question you need to explain what you are doing and what the problem is.  Scriptlistener code is nothing more than a hard coded actions steps and the recorded code is not really that readable without knowing the Photoshop function the code was record for.  Scriptlistener code is also not that useful in Photoshop without modifying it by adding variables into the code and making functions for its use so you can work with other then what the code was recorded for.  Do you always want to do the same layer with the same mask.  If the document is changes and that layer does not exist the code that did work will fail and when the code executed the action step with an executeAction(); statement it will fail and you will get and error message.

               

              Adobe Photoshop DOM does not cover all of Photoshop functions.  All that Photoshop can do, can not be done using Adobe's scripting DOM.  Some thing the can not be done using DOM can be done using Action Manager scripting code but again all thing the you can do in Photoshop can not be recorded. Some things that can not be recorded in actions can be inserted into actions and can also be used in Photoshop scripts. Still there as things you can do in Photoshop that can not be automated with scripts and actions.

              • 4. Re: Tell me how to work with layer masks in the CC2015 (better at DOM)
                AndreyLarush Level 1

                2017-01-19_182746.png

                 

                Thanks for the reply

                Have an open Photoshop document. He's got 1 layer - an arbitrary rectangle, with the usual layer mask. 2 layer - inserted and already resize the image to which you want to apply the mask with 1 layer.

                 

                • 5. Re: Tell me how to work with layer masks in the CC2015 (better at DOM)
                  JJMack Most Valuable Participant

                  The way you write it sound like you do not know how to explain what you are trying to do in Photoshop you do no describe the steps you are using to do what ever you want to do.  You can add layers and layer mask with photoshop scripting.  Here is a  video that shoen one of my collage script in action.  In the video yoy will see five layers added to a template docment ana have layers masks added the the  five added layers.

                  1 person found this helpful
                  • 6. Re: Tell me how to work with layer masks in the CC2015 (better at DOM)
                    AndreyLarush Level 1

                    and where can I see this script ?

                    • 7. Re: Tell me how to work with layer masks in the CC2015 (better at DOM)
                      JJMack Most Valuable Participant

                      Been posted many times. The download link is in the documentation link

                       

                      Photo Collage Toolkit

                       

                      Photoshop scripting is powerful and I believe this package demonstrates this A video showing a 5 image collage PSD template  being populated with images:

                       

                      The package includes four simple rules to follow when making Photo Collage Template PSD files so they will be compatible with my Photoshop scripts.

                      1. Size the photo collage templates for the print size you want - width, height and print DPI resolution.
                      2. Photo collage templates must have a Photoshop background layer. The contents of this layer can be anything.
                      3. Photo collage templates must have alpha channels named "Image 1", "Image 2", ... "Image n".
                      4. Photo collage templates layers above the background layers must provide transparent areas to let the images that will be placed below them show through.

                       

                      There are fifteen scripts in this package they provide the following functions:

                      1. HelpPhotoCollageToolkit.jsx - Online Help
                      2. TestCollageTemplate.jsx - Used to test a Photo Collage Template while you are making it with Photoshop.
                      3. CollageTemplateBuilder.jsx - Can build Templates compatible with this toolkit's scripts.
                      4. LayerToAlphaChan.jsx - Used to convert a Prototype Image Layer stack into a template document.
                      5. InteractivePopulateCollage.jsx - Used to interactively populate Any Photo Collage template. Offers most user control inserting pictures and text.
                      6. ReplaceCollageImage.jsx - use to replace a populated collage image Smart Object layer with an other image correctly resized and positioned.
                      7. ChangeTextSize.jsx - This script can be used to change Image stamps text size when the size used by the populating did not work well.
                      8. PopulateCollageTemplate.jsx - Used to Automatically populate a Photo Collage template and leave the populated copy open in Photoshop.
                      9. BatchOneImageCollage.jsx - Used to Automatically Batch Populate Collage templates that only have one image inserted. The Collage or Image may be stamped with text.
                      10. BatchMultiImageCollage.jsx - Used to Automatically Batch Populate Any Photo Collage template with images in a source image folder. Easier to use than the interactive script. Saved collages can be tweaked.
                      11. PasteImageRoll.jsx - Paste Images into a document to be print on roll paper.
                      12. BatchPicturePackage.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder.  Images Rotates for best fit.
                      13. BatchPicturePackageNoRotate.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder.
                      14. PopulatePicturePackage.jsx - Used to Automatically populate a Photo Collage template Fill with the same single image and leave the populated copy open in Photoshop.
                      15. PCTpreferences.jsx - Edit This File to Customize Collage Populating scripts default setting and add your own Layer styles.

                       

                      Documentation and Examples

                      1 person found this helpful
                      • 8. Re: Tell me how to work with layer masks in the CC2015 (better at DOM)
                        AndreyLarush Level 1

                        This is worked :-)

                         

                        var idslct = charIDToTypeID( "slct" );
                            var desc199 = new ActionDescriptor();
                            var idnull = charIDToTypeID( "null" );
                                var ref181 = new ActionReference();
                                var idLyr = charIDToTypeID( "Lyr " );
                                ref181.putName( idLyr, objDocs.nameShbl);
                            desc199.putReference( idnull, ref181 );
                            var idMkVs = charIDToTypeID( "MkVs" );
                            desc199.putBoolean( idMkVs, false );
                            var idLyrI = charIDToTypeID( "LyrI" );
                                var list107 = new ActionList();
                                list107.putInteger( 85 );
                            desc199.putList( idLyrI, list107 );
                        executeAction( idslct, desc199, DialogModes.NO );

                        // =======================================================
                        var idMk = charIDToTypeID( "Mk  " );
                            var desc200 = new ActionDescriptor();
                            var idNw = charIDToTypeID( "Nw  " );
                            var idChnl = charIDToTypeID( "Chnl" );
                            desc200.putClass( idNw, idChnl );
                            var idAt = charIDToTypeID( "At  " );
                                var ref182 = new ActionReference();
                                var idChnl = charIDToTypeID( "Chnl" );
                                var idChnl = charIDToTypeID( "Chnl" );
                                var idMsk = charIDToTypeID( "Msk " );
                                ref182.putEnumerated( idChnl, idChnl, idMsk );
                                var idLyr = charIDToTypeID( "Lyr " );
                                ref182.putName( idLyr, objDocs.shortName );
                            desc200.putReference( idAt, ref182 );
                            var idUsng = charIDToTypeID( "Usng" );
                                var ref183 = new ActionReference();
                                var idChnl = charIDToTypeID( "Chnl" );
                                var idChnl = charIDToTypeID( "Chnl" );
                                var idMsk = charIDToTypeID( "Msk " );
                                ref183.putEnumerated( idChnl, idChnl, idMsk );
                                var idLyr = charIDToTypeID( "Lyr " );
                                var idOrdn = charIDToTypeID( "Ordn" );
                                var idTrgt = charIDToTypeID( "Trgt" );
                                ref183.putEnumerated( idLyr, idOrdn, idTrgt );
                            desc200.putReference( idUsng, ref183 );
                        executeAction( idMk, desc200, DialogModes.NO );

                        // =======================================================
                        var idDlt = charIDToTypeID( "Dlt " );
                            var desc201 = new ActionDescriptor();
                            var idnull = charIDToTypeID( "null" );
                                var ref184 = new ActionReference();
                                var idLyr = charIDToTypeID( "Lyr " );
                                var idOrdn = charIDToTypeID( "Ordn" );
                                var idTrgt = charIDToTypeID( "Trgt" );
                                ref184.putEnumerated( idLyr, idOrdn, idTrgt );
                            desc201.putReference( idnull, ref184 );
                            var idLyrI = charIDToTypeID( "LyrI" );
                                var list108 = new ActionList();
                                list108.putInteger( 85 );
                            desc201.putList( idLyrI, list108 );
                        executeAction( idDlt, desc201, DialogModes.NO );

                        }