The Disable function disables an event or all events. The specified event will not be anymore triggered by OnAction.
Used to stop an event triggering.
<action_identifier>, constant, identifier of the event to disable. If not specified, all the events are disables.
The Compiler checks if <action_identifier> has been previously defined and returns a compilation error if not.
The Disable function can only be used in the script after the event has been activated.
The Disable function can be inserted in the Sub managing the <action_identifier>; the event is then taken out of the list of events to be managed and execution continues.
'Use of OnAction/Disable/Enable functions for clicking the OK button of an IE popup window
res=msgbox("Would you like to close the message box? ",4,"EXAMPLE")
if res=6 then
' if res=6, close the popup and stop the script
UseWindow("IEXPLORE.EXE|#32770|Message from webpage",topinstance())
'OnAction triggers when the popup window appears
InWindowAnyInstance("IEXPLORE.EXE|#32770|Message from webpage")
UsePage("WinTask Demonstration Pages")
'Make the popup window appear
ClickHTMLElement("A[INNERTEXT= 'Popup window']")
'Leave the management of the random events active.