I can select all objects in current layer with the following
but, how do I loop through all layers and add their shapes to Selection?
or you can just press Ctrl-A (:
I needed to do it in a macro.
There is a GUI button to select all objects. You can "press" it via macro:
Nice, but his way also selects shapes/objects of Desktop layer in Master Page (if any...).
You can select all of them in this way and than remove the ones staying on Desktop layer. And also can use it if no shape on Master Page.
Anyhow Eskimo's code remains the most beautiful... :-)
And if it is just a matter of selection it can be even shorter (just one line):
ActivePage.Shapes.FindShapes(, , False, "@type != 'guide' and @com.layer.isguideslayer = 'False' and @com.layer.isdesktoplayer = 'False'").CreateSelection
Thanks; even more beautiful!
FaneDuru said:Anyhow Eskimo's code remains the most beautiful... :-)
Thank you for the kind words!
I am not an expert on CQL, but it has really changed how I approach a lot of tasks in CorelDRAW.
It is difficult to become a CQL expert, looking only to what you can find here. And something else (coming from Corel) I did not see, even if I would study it with a lot of joy... I have an Excel file with a dedicated page to CQL code examples. I created something just using my imagination and others coming from here, Oberon etc. mostly from Shelby.
You must cultivate your imagination and just try. Looking to Intellisense suggestions and try.
I did not imagine such a way. Now being inspired (by you) the code can be made even shorter:
ActivePage.Shapes.FindShapes(, , False, "@type != 'guide' and @com.layer.isSpeciallayer = 'False'").CreateSelection
IsSpecialLayer returns true in case of guideline, desktop, or grid layers... The guide shape must be checked because if you copy one and an ordinary layer is active, it is copied on this one after Paste. It happened to me many times especially when I tried to copy guide lines inclined with a specific angle.