6 Replies Latest reply on Jan 12, 2011 9:25 AM by pkrk

    Graphics

    pkrk

      I am building a script that will in part loop through and check all the Graphics in the document for a certain swatch.

      It works correctly for "Image" when I check for fillColor, strokeColor and gapColor... but not much else.

       

      I'm wondering if it is even possible to check for the embedded swatch in a placed PDF, EPS....?(Will I have to take it a step further and create clipping paths ?)

       

      Below is a sample of what works with Image if the color is set in Indesign when looping through all the Graphics.

       

      myGraphicsFillColor = myGraphics[graphCount].fillColor.name

       

       

      Thank you in advance!

        • 1. Re: Graphics
          pkrk Level 1

          I'm just rephrasing my question and hoping I have better luck on this one.

           

          If there is an EPS or a PDF that has been placed in an Indesign document, is there a way through scripting to know what swatches it uses?

          • 2. Re: Graphics
            Harbs. Level 6

            Not that I know of.

             

            If you are really desperate you might be able to use cross app scripting to open it in Illustrator and find out there...

             

            Harbs

            • 3. Re: Graphics
              pkrk Level 1

              Trying to avoid that as it probably entails a lot more than I can chew.

              Thanks for your response!

              • 4. Re: Graphics
                [Jongware]-9BC6tI Level 4

                Thinking outside the box: what if you create a new document, remove all swatches (only Black and Paper and None would be left, because you can't remove these), paste your graphic in it and see what swatches get added?

                • 5. Re: Graphics
                  Muppet Mark-QAl63s Level 4

                  I suppose a lot would depend on the 'graphic' in question, it's type and it's 'creator'. I get a reasonable amount of milage from reading the filehead data from such files… Im on a mac so I can filter files before hand based on their creators. That said this works with my CS2 illustrator files…

                   

                  var aiGraphic = new File('~/Desktop/Colors/CMYK_Doc_PMS.ai');
                  
                  var aiSpots = graphicSpots(aiGraphic);
                  
                  alert(arrayToString(aiSpots,'\r'));
                  
                  function graphicSpots(f) {
                       var colorList = Array();
                       f.open('r');
                       while (!f.eof) {
                            var line = f.readln();     
                            if (/%%DocumentCustomColors:/.test(line)) {     
                                 colorList.push(line.substring(25, line.length-1));          
                                 var nextLine = f.readln();                    
                                 while (/^%%CMYKCustomColor:/.test(nextLine) == false) {
                                      colorList.push(nextLine.substring(5, nextLine.length-1));
                                      nextLine = f.readln();
                                 }
                            }
                       }
                       f.close();
                       return colorList;
                  }
                  
                  function arrayToString(arr,d) {
                       return arr.join(d);
                  }
                  

                  1 person found this helpful
                  • 6. Re: Graphics
                    pkrk Level 1

                    Thanks. I'm trimming the fat off the rest of my script at the moment and will revisit the topic shortly. I have some questions but I want to make sure I know more about what I'm asking before I waste your time.

                     

                    Thanks again!