Home > Language Reference > Program Flow Functions > Enable

Enable

The Enable function re-enables an event. The event is triggered by OnAction.

Usage

Used to re-enable an event triggering after it has been disables.

Syntax

Enable(<action_identifier>)  

Parameters

<action_identifier>, constant, identifier of the event to enable. 

See also

Enable
OnAction
Sleep

Example

'Use of OnAction/Disable/Enable functions for clicking the OK button of an IE popup window
Sub close()
Disable(popup)
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())
Click(Button,"OK")
stop
endif
Enable(popup)
EndSub

OnAction popup
'OnAction triggers when the popup window appears
WinStatus(Active)
InWindowAnyInstance("IEXPLORE.EXE|#32770|Message from webpage")
DoSub close
EndAction

StartBrowser("IE", "www.wintask.com/demos",3)

UsePage("WinTask Demonstration Pages")
 ClickHTMLElement("A[INNERTEXT= 'Form']")

UsePage("Form")
'Make the popup window appear
 ClickHTMLElement("A[INNERTEXT= 'Popup window']")

sleep()
'Leave the management of the random events active.