8 Replies Latest reply on Aug 16, 2014 5:47 PM by [Jongware]

    Indd CS6 script request

    palodislow

      How would it be the javascript code to set the transparency blend space of a document to rgb in INDD CS6?

       

      Pablo López

        • 1. Re: Indd CS6 script request
          [Jongware] Most Valuable Participant

          Pablo,

           

          Browsing through the index of Adobe InDesign CS6 (8.0) Object Model JS, I see a BlendingSpace (enum): "Transparency blending space options." These are the values that can be assigned to (looking at the bottom of that page) "TransparencyPreference.blendingSpace". Following the TransparencyPreference link, you arrive at TransparencyPreference, and there at the bottom is where it's used: "Document.transparencyPreferences"

           

          This suggests the full line

           

          app.activeDocument.transparencyPreferences.blendingSpace = BlendingSpace.RGB;
          

           

          should do it.

          • 2. Re: Indd CS6 script request
            palodislow Level 1

            Wow, thank you very much.

             

            Since I don´t know anything on scripting can you tell me how would it be if I want a whole script to:

            open many indd files from a selected folder,

            change the transparency blend space to rgbon the files,

            save the files and close them?

             

            Best.

             

            Pablo López

            • 3. Re: Indd CS6 script request
              TᴀW Adobe Community Professional & MVP

              You can use Peter Kahrel's script to batch process a folderfull of files.

               

              Check it out here: http://indesignsecrets.com/creating-batch-pdfs.php

              • 4. Re: Indd CS6 script request
                [Jongware] Most Valuable Participant

                Note that the Scripting forum is not meant for "requesting scripts" (even though we have been seeing a lot of these, lately).

                The Illustrator Scripting Forum makes this abundantly clear, right on the starting page:

                scriptingforum.PNG

                 

                Unfortunately, for some reason a similar text does not appear on this forum, which may be the reason this one is flooded with "requests" and the Illustrator Scripting forum is not.

                 

                See also Re: Can you fix my script problem? for a very appropriate parable.

                 

                Bottom lines:

                 

                1. If you want someone to write you a script, hire a freelancer. If you want a free script, hire a freelancer and then don't pay him.

                 

                2. If you want to learn how to write scripts, read the documentation, then try for yourself.

                See

                InDesign developer documentation | Adobe Developer Connection

                How do I start learning InDesign Scripting?

                 

                3. If you need help finding some object or function in InDesign, look in the online pages I pointed you to. Only if you cannot find it, ask.

                 

                4. Do not use titles such as "Why this unfunction", "Plz Correct My Script", "Need a script to [xxx]".

                • 5. Re: Indd CS6 script request
                  Pickory Level 3

                  "1. If you want someone to write you a script, hire a freelancer. If you want a free script, hire a freelancer and then don't pay him."

                   

                  Cheered me up, thank you. LOL.

                  • 6. Re: Indd CS6 script request
                    [Jongware] Most Valuable Participant

                    What a timely article! Yup, no need to write a custom script when there is one that does the job.

                    This even allows you to run an 'external' script, wow! So Pablo, you would make a line-line script to set the RGB blend space, save it, then run *this* script to process a folder. Use the Run A Script checkbox and choose your blend-setting script. Then sit back and let the computer do its thing.

                    • 7. Re: Indd CS6 script request
                      palodislow Level 1

                      I figure it out like this

                       

                      var myFolder = Folder.selectDialog("Select Indesign Folder"); 

                      var myIndsnFiles = myFolder.getFiles("*.indd"); 

                       

                      for(k=0; k<myIndsnFiles.length; k++) 

                          app.open(myIndsnFiles[k]); 

                       

                          app.activeDocument.transparencyPreferences.blendingSpace = BlendingSpace.RGB; 

                       

                       

                          app.activeDocument.save();

                       

                          app.activeDocument.close(); 

                       

                          }

                      • 8. Re: Indd CS6 script request
                        [Jongware] Most Valuable Participant

                        Very good, congratulations!

                         

                        Two very minor annotations (you did well so far):

                         

                        1. app.open returns a Document, so you can use

                         

                           myDoc = app.open(..

                           myDoc.transparencyPreferences.blendingSpace = ..

                           myDoc.save();

                        (et cetera)

                         

                        You can open a document without showing the file, which is usually faster - but then activeDocument will not work. (See app.open for that option).

                         

                        2. No need to first do myDoc.save(), then myDoc.close(). See the options for document.close() -- you can close and save in one step.