4 Replies Latest reply on Jun 22, 2017 5:28 PM by Yuliascript

    How to assign blend mode to a graphic in indesign CS6, javascript

    Yuliascript Level 1

      Hi,

       

      I need to set blend mode for artwork to multiply in Indesign CS 6 through Javascript:

       

       

      myLinkFile = myFrame.place (myFile);
      myFile.blendmode = multiply;
      

       

       

      But I was not able to find it in Object Model Viewer.

       

       

      Thank you.

      Yulia

        • 1. Re: How to assign blend mode to a graphic in indesign CS6, javascript
          Laubender Adobe Community Professional & MVP

          Hi Yulia,

          see into:

          Adobe InDesign CS6 (8.0) Object Model JS: TransparencySetting

           

          Climb up in the hierarchy of objects to get to e.g. contentTransparencySettings etc.pp. if needed.

           

          Here an example with transparencySettings :

           

          // Example
          // Select an object on the page
          
          var item = app.selection[0];
          
          item.transparencySettings.blendingSettings.properties =
          {
              blendMode : BlendMode.MULTIPLY ,
              opacity : 50 ,
              isolateBlending : false ,
              knockoutGroup : false
          };
          

           

          Best download the iChm files to search in DOM documentation by Jongware here:

          Indesign JavaScript Help

           

          Regards,
          Uwe

          • 2. Re: How to assign blend mode to a graphic in indesign CS6, javascript
            Yuliascript Level 1

            Yes, thank you, it did work. I had to remove opacity, but all else is good:

             

             

            var item = app.selection[0]; 
            
            item.transparencySettings.blendingSettings.properties = 
            { 
                blendMode : BlendMode.MULTIPLY , 
                isolateBlending : false , 
                knockoutGroup : false 
            }; 
            

             

             

            Yulia

            • 3. Re: How to assign blend mode to a graphic in indesign CS6, javascript
              Laubender Adobe Community Professional & MVP

              myLinkFile = myFrame.place (myFile);

              myFile.blendmode = multiply;

               

              Hi Yulia,

              why do you like to set the blendmode to the contents of variable myFile ? Your code is suggesting this.
              I guess, there is actually a file object stored with this variable. You cannot set transparency to a file stored in your system.
              For that you would like to open it in the creator app and set transparency there.

               

              Instead you would set transparency to a placed "thing" on a page in InDesign that could be anything depending on your file type.
              An image, a vector graphic, a PDF etc.pp.

               

              So check what's in variable myLinkFile that is returned by method place() :

              $.writeln(myLinkFile);
              

               

              But be not misguided what you see with that. Also ask:

              $.writeln(myLinkFile.constructor.name);
              

               

              And if that's clear, also do:

              $.writeln(myLinkFile.length);
              

               

              And maybe you want to know:

              $.writeln(myLinkFile[0].constructor.name);
              

               

              And now think about what object you like to set to multiply.


              The "thing" inside the frame?

              ( Could also be outside the frame depending on the file type you are placing even if you do myFrame.place() ) [*]

              myLinkFile[0]
              

               

              or the frame, that would be:

              myFrame
              

               

              That frame could be also defined as:

              myLinkFile[0].parent
              

              But it's not sure if myFrame and myLinkFile[0].parent is always the same object. [*]

               

              Look up this:

              Adobe InDesign CS6 (8.0) Object Model JS: Rectangle

               

              Would variable myLinkFile always be of length 1 ?
              Depending on the file type—see into IDMS snippet files—the length could be different.
              E.g. if the IDMS snippet file you want to place contains several ungrouped page items.

               

              [*] FWIW: If you do method place() on a graphic frame with an IDMS snippet file the contents will placed on the spread where the graphic frame resides. And not in the frame. No error message…

               

              Regards,
              Uwe

              • 4. Re: How to assign blend mode to a graphic in indesign CS6, javascript
                Yuliascript Level 1

                Hi Uwe,

                 

                You are absolutely correct. It did not work when I used it on File object, so I tried it on the rectangle object containing the file and it did work.

                 

                Thank you.