1 Reply Latest reply on May 21, 2010 9:06 PM by milligramme

    Color conversion   InDesign CS4 js

    Yuliaart Level 1

      Hi, I need to convert all spot colors in Indd into Process color. Here what I've got that is not working:

       

      function myConvertColor (){
      var a = 0;
      var myColor = myDoc.colors.item[a];
      for (var a =0; a<myDoc.colors.length; a++){
          myColor.model = ColorModel.PROCESS;
      }
      

       

      It stops on the color assigning line.

       

      Thank you very much for your help.

      Yulia

        • 1. Re: Color conversion   InDesign CS4 js
          milligramme Level 3
          Hi, I need to convert all spot colors in Indd into Process color. Here what I've got that is not working:

           

          function myConvertColor (){
          var a = 0;
          var myColor = myDoc.colors.item[a];
          for (var a =0; a<myDoc.colors.length; a++){
              myColor.model = ColorModel.PROCESS;
          }
          

           

          It stops on the color assigning line.

          Indesign Color-Objects contain reserved colors such as "Paper", "Black", "Registarion", "Cyan", "Magenta", "Yellow".

          You can't change those properties, so use "try ~ catch ~ " statement to escape.

           

          and expression of myColor  variable is not correct.

           

          try this code, it will run.

          doc=app.documents[0];

          myConvertColor(doc);

           

          function myConvertColor (doc){
          var myColor = doc.colors;
          for (var a =0; a<doc.colors.length; a++){
              $.writeln(myColor[a].name);
              try{
                   myColor[a].model = ColorModel.PROCESS;
                   }catch(e){}
               }
          }