The macro is not executed step by step

Hello folks

I have a problem with this macro and have reached the limits of my knowledge.

The macro should perform the following steps:
In Join Curves Docker select the Bezier option, then press Apply, when Apply has been executed, then the Extend option should be selected.

Now we come to my problem:
The macro executes Apply with the Extend option and not with Bezier, although the order in the code is correct. Even inserting Sleep does not change the behavior of the macro. I have also tried to control the control elements via HWND with Sendkeys BM_CLICK. The same problem occurs there. If I omit the Extend option in the code, the curve is shot with the Bezier option.

Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" _
    (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Const BM_CLICK = &HF5

Sub Join_Curves_Bezier_Once()

Dim ApplyGUID As String ' GUID
Dim SelBezierGUID As String ' GUID
Dim SelExtendGUID As String ' GUID
Dim Dockr As String ' GUID

SelBezierGUID = "a5cabe8f-3403-4973-8280-bfd12f4b4223"
ApplyGUID = "1ec6f3a8-566d-6dbf-40c1-35e6402e4bd3"
SelExtendGUID = "23ce5d3a-8fdd-46cc-84f5-1513ce1d2a87"
Dockr = "d632ed56-5e70-bca1-43f8-249a6342dbf2"

Dim hwndButtonBezier As Long
Dim hwndButtonApply As Long
Dim hwndButtonExtend As Long

hwndButtonBezier = Application.FrameWork.Automation.GetItemInstanceHwnd(Dockr, SelBezierGUID)
hwndButtonApply = Application.FrameWork.Automation.GetItemInstanceHwnd(Dockr, ApplyGUID)
hwndButtonExtend = Application.FrameWork.Automation.GetItemInstanceHwnd(Dockr, SelExtendGUID)

Debug.Print "HWND Values As Long:   " & hwndButtonBezier
Debug.Print "HWND Values As Long:   " & hwndButtonApply
Debug.Print "HWND Values As Long:   " & hwndButtonExtend


'	*****  This part is not executed correctly. *****   '
Application.FrameWork.Automation.InvokeItem SelBezierGUID
Application.FrameWork.Automation.InvokeItem ApplyGUID
Application.FrameWork.Automation.InvokeItem SelExtendGUID

End Sub



Do any of you know what the problem is?

Thanks in advance.

Greetings,
Corel Mutt

Parents
  • I am not sure that I am seeing the problem. Skipping down to the part you have marked and not executing correctly. 

    The first line correctly changes the Join Curves to Bezier Curve


    The second line correctly presses the Apply Button

    The third line then corrects set the Join Cuves back to Extended



    Looks like it is all working for me. 

    Also, if you are going to do the Extend Join Curves type, you can do it this way via a CustomCommand

    Sub CustomCommandJoinCurves()
        ActiveShape.CustomCommand "ConvertTo", "JoinCurves", 0.5
    End Sub
    


    Happy Coding, 

    -Shelby

Reply Children
No Data