Skip navigation
alexthebake
Currently Being Moderated

How do I Select all the items in a document based on SpotColor?

Jun 28, 2012 1:46 PM

Tags: #illustrator #color #javascript #selection #scripting #illustrator_cs5 #selection_color

I'm trying to select every object with the color "CutContour"

So far I've been trying:

 

myDoc.selection = myDoc.spots.getByName("CutContour");

 

I guess this obviouslly wouldn't work though because myDoc.selection is looking for an array of objects.

However, I can't figure out how to loop through all the objects in the document and check to see if they contain the SpotColor.

 

Any help would be incredibly appreciated!

 

EDIT:

I want to use the Select > Same > Stroke Color , but I heard that using that in Javascript isn't available unless you have CS6 (which I currently don't). Is it true that accessing menu items through scripting is a feature in CS6?

 
Replies
  • Currently Being Moderated
    Jun 28, 2012 2:10 PM   in reply to alexthebake

    Yes you can't do this as straight forward as you hoped… In script probably the same as is done in those app/plug-in's you will need to loop through all the art items and test each in turn… Depending upon your art in question this can become a very complex routine… Why are you trying to select this stuff?

     

    doc.selection = [ wants an array of objects ]

     

    myDoc.spots.getByName("CutContour") is only going to find an object reference to a spot swatch in the document swatches panel if it exists…

     

    You can't put these together like you have done…

     

    To your edit Yes its a new thing with CS6… I don't have this either… boo

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 28, 2012 2:54 PM   in reply to alexthebake

    pageItems is a super class like swatches It covers a few common/shared properties but under each are sub-classes that contain more specific properties…

     

    getting pageItems will return an array but it could be mix of [ pathItem, textItem, groupItem etc. ]

     

    getting swatches could return [ spot, rgb, cmyk, gradient etc. ]

     

    If you are wanting to access only pathItems then access that collection at what ever object level you want to deal with… e.g.

     

    var a = doc.pathItems;

     

    You can check the collections length property and create a loop…

     

    For each item you can test the pathItem for it's .fillcolor & .strokecolor properties

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 29, 2012 1:32 PM   in reply to alexthebake

    Wow you use the CutCountour for Roland printer?  is it 100% cyan? 

     

    Ok I had a similar need and I figured out:

     

    if(objects[i].fillColor.typename == "SpotColor"){

         if(objects[i].fillColor.spot.name =="CutContour"){

              //process the objects[i]

         }

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points