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?
You can find OverPrint like this:
Sub CheckOverPrint() Dim srOverPrint As ShapeRange Set srOverPrint = ActivePage.Shapes.FindShapes(Query:="@com.overprintfill = true or @com.overprintoutline = true") MsgBox srOverPrint.Count End Sub
Thanks Shelby. These are working great.Here is something I am trying to do, but it is failing inside the IF statement. I can get the LensEffect, but I am trying to get the name (ie FishEye, etc.). I even tried to do a compare in the query and that didn't work.
Dim effectsLensShapes As ShapeRange
Set effectsLensShapes = ActivePage.Shapes.FindShapes(Query:="!@com.Effects.LensEffect.IsNull")If (effectsLensShapes.Count > 0) Then
Set effectsLensTypes = ActivePage.Shapes.FindShapes(Query:="@com.Effects.LensEffect.Lens.Type = 'cdrLensFishEye'")
End If
Any help would be great and appreciated.
Thanks
Tom,
Depending on what you are doing you really shouldn't need the If Then, CQL will find just the specific Lens Type. But again, that depends on your end goal. :-) Second, if I was using the If I wouldn't search the entire page again I would only search your already found ShapeRange. :-) Finally, instead of using cdrLensFishEye you need just just use the number. So cdrLensFishEye is equal to 1. I will include the list.
Sub Lenses() Dim effectsLensShapes As ShapeRange Dim effectsLensTypes As ShapeRange Set effectsLensShapes = ActivePage.Shapes.FindShapes(Query:="!@com.Effects.LensEffect.IsNull") If (effectsLensShapes.Count > 0) Then Set effectsLensTypes = effectsLensShapes.Shapes.FindShapes(Query:="@com.Effects.LensEffect.Lens.Type = 1") End If End Sub
Here are the number values:
GREAT!!!!
The list was perfect.
I have 2 other requests that can up in our designer meeting. Can these also be done in CQL?
1) Check for Powerclips and then get the shapes that are in a Powerclip.
2) The other is to check the nodes of a shapes to see if they are over 10,000 nodes or more.
Thanks,
Hello,
you want it probably with VBA it self create?
This macro could do it probably also
http://macros.cdrpro.ru/cdrpreflight
Were you able to figure out #1 and #2? Been trying to figure it out but have difficulties.
Any help would be appreciated.