View Single Post
Old 20-07-2006, 16:10
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4

No, CustomCommand is a special command that allow executing plug-in commands provided by plug-in tools (provided that the tool offers automation support and implements this method).

Boundary/Smart Fill tool is one of those tools acting as a plugin (not really a native feature internally). And luckily it does support CustomCommand method:

Sub CreateBoundary()
    Dim s1 As Shape
    Set s1 = ActiveSelection.CustomCommand("Boundary", "CreateBoundary")
End Sub
Smart Fill:
Sub SmartFill()
    Dim s1 As Shape
    Set s1 = ActivePage.CustomCommand("Boundary", "SmartFill", 3.293287, 7.167413, CreateCMYKColor(40, 20, 0, 40), 0.003, CreateCMYKColor(0, 0, 0, 100))
End Sub
Another tool in Draw that supports this is Crop:

Sub Macro1()
    Dim crop1 As ShapeRange
    Set crop1 = ActiveSelection.CustomCommand("Crop", "CropRectArea", 1.18852, 6.320039, 6.136091, 9.545528)
End Sub
Or if you want to specify the rotation of the crop marquee:
Sub Macro2()
    Dim crop2 As ShapeRange
    Set crop2 = crop1.CustomCommand("Crop", "CropRectArea", -1.435606, 7.278252, 4.222665, 10.50224, 20#)
End Sub
The actual command and parameters are plug-in specific, so it is better to use recorder to figure out what goes where...

In order to invoke a command by GUID, you can use a new methods of CorelDRAW X3 SP1:

Application.Framework.Automation.Invoke guid

Last edited by Alex; 21-07-2006 at 07:14.
Reply With Quote