Forum Discussion
Dmitry_Nikolaev
Staff
14 years agoHi Ory,
When your original test is stopped at the breakpoint, the separate thread executing the asynchronous operation is also paused. This is a specific of the script debugger - it pauses all executing script if even only one of them is paused. So, this your experiment shows that the asynchronous call actually works as expected.
That is why it is necessary to try to get CMD windows several times in a loop. The first attempt of getting the CMD window can fail since the Run ESL Script button is not clicked yet.
However, I think that it is possible to click the button asynchronously without using the CallObjectMethodAsync method in this case. Probably, this approach will work better for you:
...
' Call Runner.CallObjectMethodAsync(Aliases.CardSharkCryptoSW.dlgCardShark.RunESLScriptBtn, "ClickButton")
MyClick Aliases.CardSharkCryptoSW.dlgCardShark.RunESLScriptBtn
...
Sub MyClick(obj)
x = obj.ScreenLeft + obj.Width / 2
y = obj.ScreenTop + obj.Height / 2
Call LLPlayer.MouseDown(MK_LBUTTON, x, y, 0)
Call LLPlayer.MouseUp(MK_LBUTTON, x, y, 100)
End Sub