Event Handling through Script_Whenever
I am trying to handle one scenario using whenever event.
Scenario is like this : In a web (Siebel) application when I try to delete a record a warning window comes showing a message "Are you sure you want to delete record...". I have created window event capturing it's caption name.
Now all is working fine except my Script_Whenever handler is not loosing the control when that window is destroyed by event handling (written in Script_Whenever procedure) and the control is not going back to my main script.
Please suggest me solution.
Please check my followin code:
Window("Application=IEXPLORE.EXE Caption='Hothouse2 Siebel eCommunications - Microsoft Internet Explorer'").Attach
Pause 3, tpPauseSeconds
If Whenever("DELETE") = True Then
MsgBox "Not Executed"
Private Sub Script_Whenever(ByVal TheEvent As TPEvents.TEventGroup)
Str = Window("Siebel Window").CaptureText
MsgBox "Error is" & " : " & Str
Re: Event Handling through Script_Whenever
Try loading your Whenever event at the beggining of the script. You currently have a 3 second pause which looks like you are waiting for the event to occur.
Looking at your current example I would wager that the event occurs sometime during the pause, the whenever is loaded and triggered, the whenever handler is then executed and then the next line executed in your script is SuspendScript.
A whenever event needs to be loaded before you would expect it to occur which is why normally you would want to load it as early as possible.