Forum Discussion
ory_z
14 years agoContributor
Hey David,
Thanks for the response. According to your suggestion, I have been using the Asynchronous call for the last 3-4 weeks, and it does seem to be improving the run time of my tests.
However, I've noticed that sometimes (without any pattern) the next line of code fails. I've tried to wrap this with all kinds of logic to handle it, but eventually it all comes back to the Async call.
I'll explain.
Here is the relevant piece of code:
---------------------------------------------------------------------------------------------------------------------------
'The following line clicks the Run ESL script in an Asynchronous manner (which proved to be faster)
Call Runner.CallObjectMethodAsync(Aliases.CardSharkCryptoSW.dlgCardShark.RunESLScriptBtn, "ClickButton")
Call aqUtils.Delay(10000, "Waiting for ESL script to run..")
'Getting the ESL CMD Window
'Turn vb error handling on
On Error Resume Next
Set ESLCMD = GetESLCMD
'If vb script exception occured terminate and restart card shark
If Err.Number <> 0 Then
....
---------------------------------------------------------------------------------------------------------------------------
So basically the delay after the call (3 seconds) is to ensure that the CMD window that the button invokes is displayed (when done manually the CMD window is displayed immediately). However the Function "GetESLCMD" (whose whole purpose is to find that CMD window) often returns with a vbScript error "Object not found" (or something similar, error code 424) and hence I've added the exception handling.
I've noticed that increasing the delay does not seem to help, in fact is looks like the delay after the Asynch call is causing issues. If you view the attached screen captures you will see then when a 3 seconds delay is used the button appears to be only clicked after the delay, when a 10 seconds delay is used the button does not seem to get clicked at all!
I've also shown in the video that adding an empty Log.Message call between the asynchronous call and the delay seems to solve the issue..? (I have not verified this, it's just an idea)
Note: I've even tried to move the delay to after the "On Error Resume Next" line with similar results.
What's going on? Should I maybe go back to calling the click button in a synchronous manner?
Thanks for the response. According to your suggestion, I have been using the Asynchronous call for the last 3-4 weeks, and it does seem to be improving the run time of my tests.
However, I've noticed that sometimes (without any pattern) the next line of code fails. I've tried to wrap this with all kinds of logic to handle it, but eventually it all comes back to the Async call.
I'll explain.
Here is the relevant piece of code:
---------------------------------------------------------------------------------------------------------------------------
'The following line clicks the Run ESL script in an Asynchronous manner (which proved to be faster)
Call Runner.CallObjectMethodAsync(Aliases.CardSharkCryptoSW.dlgCardShark.RunESLScriptBtn, "ClickButton")
Call aqUtils.Delay(10000, "Waiting for ESL script to run..")
'Getting the ESL CMD Window
'Turn vb error handling on
On Error Resume Next
Set ESLCMD = GetESLCMD
'If vb script exception occured terminate and restart card shark
If Err.Number <> 0 Then
....
---------------------------------------------------------------------------------------------------------------------------
So basically the delay after the call (3 seconds) is to ensure that the CMD window that the button invokes is displayed (when done manually the CMD window is displayed immediately). However the Function "GetESLCMD" (whose whole purpose is to find that CMD window) often returns with a vbScript error "Object not found" (or something similar, error code 424) and hence I've added the exception handling.
I've noticed that increasing the delay does not seem to help, in fact is looks like the delay after the Asynch call is causing issues. If you view the attached screen captures you will see then when a 3 seconds delay is used the button appears to be only clicked after the delay, when a 10 seconds delay is used the button does not seem to get clicked at all!
I've also shown in the video that adding an empty Log.Message call between the asynchronous call and the delay seems to solve the issue..? (I have not verified this, it's just an idea)
Note: I've even tried to move the delay to after the "On Error Resume Next" line with similar results.
What's going on? Should I maybe go back to calling the click button in a synchronous manner?