autoit v3 code
; clicks left mouse button while target window has focus and numlock is enabled
; tray options control clicking speed
#AutoIt3Wrapper_UseUpx=n
#include
#include
#include
#include
#include
#include
#include
#include
#include
Opt("TrayAutoPause", 1)
Opt("TrayMenuMode", 1)
Global $timervalue
$Msg = TrayCreateItem("Enable numlock to autoclick!")
$timer1 = TrayCreateItem(" 1/sec",-1,-1,1)
$timer3 = TrayCreateItem(" 3/sec",-1,-1,1)
$timer10 = TrayCreateItem(" 10/sec",-1,-1,1)
TrayItemSetState(-1, $TRAY_CHECKED)
$timer25 = TrayCreateItem(" 25/sec",-1,-1,1)
$timer100 = TrayCreateItem("100/sec",-1,-1,1)
$exit = TrayCreateItem("Exit",-1,-1,0)
TraySetState()
$windowTitleText = "myWindow"
Global Const $VK_NUMLOCK = 0x90
Func _GetNumLock()
Local $ret
$ret = DllCall("user32.dll","long","GetKeyState","long",$VK_NUMLOCK)
Return $ret[0]
EndFunc
while 1
Local $msg = TrayGetMsg()
Switch $msg
Case $exit
Exit
Case $timer1
$timervalue = 1
Case $timer3
$timervalue = 3
Case $timer10
$timervalue = 10
Case $timer25
$timervalue = 25
case $timer100
$timervalue = 100
EndSwitch
if _getNumLock() <> 0 then
$title = WinGetTitle("")
if StringInStr ($title, $windowTitleText, 0) then
MouseClick ( "left" )
endif
endif
sleep (int(1000 / $timervalue))
wend
Func _IsPressed($hexKey)
Local $aR, $bO
$hexKey = '0x' & $hexKey
$aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
$bO = 1
Else
$bO = 0
EndIf
Return $bO
EndFunc ;==>_IsPressed