I am trying to figure out how to find if there are any spot colors in the CDR file using CQL
I am able to find Fountains by during thisActivePage.Shapes.FindShapes(Query:="@fill.type = 'fountain'")
But how do I write the query to see if there are any spot colors, pantones, cmyk, rgb, lab, etc.So tried this and it does not workActivePage.Shapes.FindShapes(Query:="@colors.find('cmyk')")Any ideas?
Thanks ,
Tom
I have an idea or two. :-) If you want to find Spot Colors you can do something like this:
Sub FindSpotColors() Dim srSpotFill As ShapeRange Dim srSpotOutline As ShapeRange Set srSpotFill = ActivePage.Shapes.FindShapes(Query:="@fill.color.IsSpot = true") Set srSpotOutline = ActivePage.Shapes.FindShapes(Query:="@outline.color.IsSpot = true") MsgBox "Fill: " & srSpotFill.Count & " Outline: " & srSpotOutline.Count End Sub
Or you could combine them like this:
Sub FindSpotColors2() Dim srSpot As ShapeRange Set srSpot = ActivePage.Shapes.FindShapes(Query:="@fill.color.IsSpot = true or @outline.color.IsSpot = true") MsgBox srSpot.Count End Sub
You can also do the same for CMYK as there is a IsCMYK:
Sub FindCMYKColors() Dim srCMYK As ShapeRange Set srCMYK = ActivePage.Shapes.FindShapes(Query:="@fill.color.IsCMYK = true or @outline.color.IsCMYK = true") MsgBox srCMYK.Count End Sub
There is no IsRGB or IsLAB so you will want to use the color.type to find these, which of course will also still work for Spot and CMYK:
Sub FindColorsByType() Dim srSpot As ShapeRange, srPantoneHex As ShapeRange Dim srCMYK As ShapeRange, srLAB As ShapeRange Set srSpot = ActivePage.Shapes.FindShapes(Query:="@fill.color.type = 'spot' or @outline.color.type = 'spot'") Set srPantoneHex = ActivePage.Shapes.FindShapes(Query:="@fill.color.type = 'pantone hex' or @outline.color.type = 'pantone hex'") Set srCMYK = ActivePage.Shapes.FindShapes(Query:="@fill.color.type = 'cmyk' or @outline.color.type = 'cmyk'") Set srLAB = ActivePage.Shapes.FindShapes(Query:="@fill.color.type = 'lab' or @outline.color.type = 'lab'") MsgBox "Spot: " & srSpot.Count & vbNewLine & _ "Pantone Hex: " & srPantoneHex.Count & vbNewLine & _ "CMYK: " & srCMYK.Count & vbNewLine & _ "LAB: " & srLAB.Count End Sub
Pantone are tricky as sometimes they will be spot, pantone hex, etc... If you want to see what CQL reports the color type as you can select your shape and type this into the immediate window:
?ActiveShape.Evaluate("@fill.color.type")
You should get a result like this:
lab
Or if you really want to get crazy. Draw several shapes, fill them with different color types, GROUP them, make sure the new group is selected and type this into the immediate window:
?ActiveShape.Evaluate("@children.foreach(array(), $lasteval.addarray($item.colors)).unique.convert($item.type).join(',')")
pantone hex,cmyk,lab,spot,spot
Hope that helps,
-Shelby
Shelby,
This is perfect!!!!
I have also done this to get any shapes that are MeshDim sr6 As ShapeRangeSet sr6 = ActivePage.Shapes.FindShapes(Query:="@type = 'Mesh'")
But I am having trouble getting Overprint Fill.
I have tried...Dim sr6 As ShapeRangeSet sr6 = ActivePage.Shapes.FindShapes(Query:="@type = 'overprint'")
and
Dim sr6 As ShapeRangeSet sr6 = ActivePage.Shapes.FindShapes(Query:="@fill.type = 'overprint'")
They both can not find the shape.
Any ideas?