5 Replies Latest reply on Dec 9, 2012 10:01 PM by indegn5

    Help. New to scripting!  Find registration colors used

    shilpa25 Level 1

      Hi!

       

      i have this script to find registration colors.... but when run in ESTK. it show errors on the below highlighted....

       

      could anyone help out this!

       

      error it throws is:

       

       

      function myCheckForRegistration(myEvent){

      var myRegistrationSwatchUsed = false;

      if(app.selection.length != 0){

      for(var myCounter = 0; myCounter < app.selection.length; myCounter++){

      if((app.documents.item(0).selection[myCounter].fillColor ==

      app.documents.item(0).swatches.item("Registration"))||

      (app.documents.item(0).selection[myCounter].strokeColor ==

      app.documents.item(0).swatches.item("Registration")){                    error is: // expected:)

      myRegistrationSwatchUsed = true;

      }

      }

      }

      if(myRegistrationSwatchUsed == true){

      alert("The Registration swatch is applied to some of the\robjects in the selection. Did you really intend to apply this swatch?");

      }

      }

       

       

      thanks

       

      shil..

        • 1. Re: Help. New to scripting!  Find registration colors used
          Laubender Adobe Community Professional & MVP

          @shilpa25 – what does the error message say exactly?

           

          If the ESTK expects a closing ")", then: one is missing.

          You should analyze your lines of code and annotate all kinds of opening and closing brackets.
          No opening bracket without a closing one.

           

          Hint: check the line where you put the error message in.
          And: you need not "group" the two terms left and right from the OR with the brackets.

           

          if( something1 == object.item(n) || something2 == object.item(n) ){
               //do something
               };
          

           

           

          Uwe

          • 2. Re: Help. New to scripting!  Find registration colors used
            indegn5 Level 1

            hellow lauv!!!

             

             

            i tried your command....

             

            ungrouped the object.item(n) between OR....

             

             

            function myCheckForRegistration(myEvent){

            var myRegistrationSwatchUsed = false;

            if(app.selection.length != 0){

            for(var myCounter = 0; myCounter < app.selection.length; myCounter++){

            if(app.documents.item(0).selection[myCounter].fillColor ==app.documents.item(0).swatches.item("Registration")||

            (app.documents.item(0).selection[myCounter].strokeColor ==app.documents.item(0).swatches.item("Registration")){                   //  error is: expected:)

            myRegistrationSwatchUsed = true};

            }

            }

            }

            if(myRegistrationSwatchUsed == true){

            alert("The Registration swatch is applied to some of the\robjects in the selection. Did you really intend to apply this swatch?");

            }

            }

             

             

            the error is:

            Screen Shot 2012-12-07 at 05.43.47.png

             

            thanks for fastidious care on my script....

             

            shall i wait for the reply...

             

            shil!

            • 3. Re: Help. New to scripting!  Find registration colors used
              indegn5 Level 1

              shil!!

               

              just tried what Laubender said.... shalli i wait for your reply, if you tried... send me your private message if yr busy to upload...

               

              thanks shil!

               

              bobby.

              • 4. Re: Help. New to scripting!  Find registration colors used
                BarbLovesInDesign Level 1

                I am curious as to why you want a script to do this, when InDesign's Preflight panel already has this feature, to find registration colors(and many more things)?  It may not be in the default "profile", but can certainly be made part of a custom profile/style, they are editable the same as other styles.....

                • 5. Re: Help. New to scripting!  Find registration colors used
                  indegn5 Level 1

                  hi barblove,,

                   

                  I m just trying to add this regs. scripti n one of my script, where it has no, of actions in it and i dont want to touch preflight panel for only this..

                   

                  thats Y.

                   

                  thanks

                  bobby..!!!!!!