#include <Misc.au3>
Global $fFunc
HotKeySet('{Esc}', '_Exit')
While 1
If _IsPressed('01') Then $fFunc = True
If $fFunc Then
_MyFunc()
EndIf
Sleep(50)
WEnd
Func _MyFunc()
$fFunc = False
;ConsoleWrite('Click' & @LF)
MsgBox(64, 'Info', 'Click')
EndFunc ;==>_MyFunc
Func _Exit()
Exit
EndFunc ;==>_Exit