Disable
Synchronization function.
The Disable function disables the management of a specified event. Not available in WinTask Lite.
Syntax
Disable(<Action_Id>)
or
Disable()Parameter
<Action_Id>, event to be disabled. This event is taken out of the list of events that WinTask manages.
Disable(): when no parameters are specified, all events are disabled.
Remarks
The compiler checks if <Id_action> has been defined.
The Disable function can only be used in the script after the event has been activated.
The Disable function can be inserted in the procedure managing the <Id_action>; the event is then taken out of the list of events to be managed and execution continues.
See also
Example code
This example shows how an event can be disabled using the Disable command; the event is defined by the OnAction command, this event is the selection of the option Close in the Explorer menu.
Sub close()
Disable(wait_for_close_menu)
res=msgbox("Would you like to close the message box? ",4,"EXAMPLE")
if res=6 then
' if res=6 WinTask closes Explorer and stops the script
CloseWindow("EXPLORER.EXE|ExploreWClass|My Documents",2)
stop
endif
Enable(wait_for_close_menu)
EndSub
OnAction wait_for_close_menu
Menu("File|&Close")
InWindow("EXPLORER.EXE|ExploreWClass|My Documents",2)
DoSub close
EndAction
shell("explorer")
' Definition of the event, each time the user selects the option Close in the Explorer menu File,
' the script runs the procedure close().
sleep()
'leaves the management of the random events active.