vinodtc
13 years agoContributor
How many times OnStopTest event handler can be called to perform action in same execution?
HI All,
I am trying to implement recovery scenario (When Vb script error gets) for my project, which contain different script units. Vb script error can be occurs any number of times during my script execution. So what I have done is, when Vb script error gets in one script unit, called the other script unit with code in the onStopTest event. But this event is executing only for first occurrence of Vb Script.
Even this is applicable for more Vb script errors in single unit also
Ex:
Script Unit1:
'GenericFunctions.CurrentFunciton is public variable.
function Main
call fun1
call fun2
call fun3
end function
function fun1
GenericFunctions.CurrentFunciton = "fun1"
msgbox "fun1"
asdfxxxx ‘ -> Will get vbscript error at this line and in turn “OnStopTest” event is calling fun2
end function
function fun2
GenericFunctions.CurrentFunciton = "fun2"
msgbox "fun2"
asdfyyyy ‘ -> Will get vbscript error at this line and in turn “OnStopTest” event has to call fun3. But this is not happening
end function
function fun3
GenericFunctions.CurrentFunciton = "fun3"
msgbox "fun3"
end function
Sub GeneralEvents_OnStopTest(Sender)
msgbox "on stop event"
if GenericFunctions.CurrentFunciton = "fun1" then
call aaaaaa.fun2
end if
if GenericFunctions.CurrentFunciton = "fun2" then
call aaaaaa.fun3
end if
End Sub
--------------------------------------------
When I try to execute from function “Main”, it will call function "fun1" and executing the line by line. Got msg box as “fun1” followed by vbscript error. so control go to OnStopTest event and calling function "fun2".
fun2 start executing and got msgbox as “fun2” followed by vbscript error.
This error in turn should go to OnStopTest event and call the function "fun3". But this is not happening. Stopping after second Vbscript error line.
My question is “How do we handle vbscript error occures more than one time during the script execution?”
I am trying to implement recovery scenario (When Vb script error gets) for my project, which contain different script units. Vb script error can be occurs any number of times during my script execution. So what I have done is, when Vb script error gets in one script unit, called the other script unit with code in the onStopTest event. But this event is executing only for first occurrence of Vb Script.
Even this is applicable for more Vb script errors in single unit also
Ex:
Script Unit1:
'GenericFunctions.CurrentFunciton is public variable.
function Main
call fun1
call fun2
call fun3
end function
function fun1
GenericFunctions.CurrentFunciton = "fun1"
msgbox "fun1"
asdfxxxx ‘ -> Will get vbscript error at this line and in turn “OnStopTest” event is calling fun2
end function
function fun2
GenericFunctions.CurrentFunciton = "fun2"
msgbox "fun2"
asdfyyyy ‘ -> Will get vbscript error at this line and in turn “OnStopTest” event has to call fun3. But this is not happening
end function
function fun3
GenericFunctions.CurrentFunciton = "fun3"
msgbox "fun3"
end function
Sub GeneralEvents_OnStopTest(Sender)
msgbox "on stop event"
if GenericFunctions.CurrentFunciton = "fun1" then
call aaaaaa.fun2
end if
if GenericFunctions.CurrentFunciton = "fun2" then
call aaaaaa.fun3
end if
End Sub
--------------------------------------------
When I try to execute from function “Main”, it will call function "fun1" and executing the line by line. Got msg box as “fun1” followed by vbscript error. so control go to OnStopTest event and calling function "fun2".
fun2 start executing and got msgbox as “fun2” followed by vbscript error.
This error in turn should go to OnStopTest event and call the function "fun3". But this is not happening. Stopping after second Vbscript error line.
My question is “How do we handle vbscript error occures more than one time during the script execution?”