Код:
#include <Misc.au3>
#include <WinAPISys.au3>
#include <WindowsConstants.au3>
HotKeySet("{PAUSE}", "Start")
HotKeySet("+{ESC}", "Quit")
$GUI = GUICreate("Кликер", 455, 190)
$InpDownUp = GUICtrlCreateInput("", 5, 5, 50, 20, 0x2000)
GUICtrlSetData(-1, IniRead(@ScriptDir & "\DelaySets.ini", "Delay", "DownUpDelay", "5"))
GUICtrlCreateLabel("задержка в миллисекундах между нажатием и отпусканием кнопки мыши", 60, 5, 380, 20, 0x0200)
$InpClicks = GUICtrlCreateInput("", 5, 30, 50, 20, 0x2000)
GUICtrlSetData(-1, IniRead(@ScriptDir & "\DelaySets.ini", "Delay", "ClicksDelay", "30"))
GUICtrlCreateLabel("задержка в миллисекундах между одиночными кликами", 60, 30, 380, 20, 0x0200)
$InpFirst = GUICtrlCreateInput("", 5, 55, 50, 20, 0x2000)
GUICtrlSetData(-1, IniRead(@ScriptDir & "\DelaySets.ini", "Delay", "FirstDelay", "100"))
GUICtrlCreateLabel("задержка в миллисекундах после первого клика", 60, 55, 380, 20, 0x0200)
$InpLBtn = GUICtrlCreateCheckbox("Левая кнопка (Shift+F1)", 5, 85, 150, 20)
GUICtrlSetState(-1, IniRead(@ScriptDir & "\DelaySets.ini", "Buttons", "Left", "4"))
$InpRBtn = GUICtrlCreateCheckbox("Правая кнопка (Shift+F2)", 160, 85, 140, 20)
GUICtrlSetState(-1, IniRead(@ScriptDir & "\DelaySets.ini", "Buttons", "Right", "4"))
$InpKey = GUICtrlCreateCheckbox("Код клавиши (Shift+F3)", 5, 115, 140, 20)
GUICtrlSetState(-1, IniRead(@ScriptDir & "\DelaySets.ini", "Buttons", "Key", "4"))
$InpCode = GUICtrlCreateInput("", 160, 115, 25, 20)
GUICtrlSetLimit(-1, 2)
GUICtrlSetData(-1, IniRead(@ScriptDir & "\DelaySets.ini", "Buttons", "Code", "20"))
GUICtrlCreateLabel("Pause - установка/снятие кликера с паузы", 5, 145, 230, 20, 0x0200)
GUICtrlCreateLabel("Shift+ESC - прекращение работы скрипта", 5, 165, 230, 20, 0x0200)
$BtnStart = GUICtrlCreateButton("Готово", 350, 85, 100, 100)
GUISetState()
Do
Switch GUIGetMsg()
Case -3
Exit
Case $BtnStart
IniWrite(@ScriptDir & "\DelaySets.ini", "Delay", "DownUpDelay", GUICtrlRead($InpDownUp))
IniWrite(@ScriptDir & "\DelaySets.ini", "Delay", "ClicksDelay", GUICtrlRead($InpClicks))
IniWrite(@ScriptDir & "\DelaySets.ini", "Delay", "FirstDelay", GUICtrlRead($InpFirst))
IniWrite(@ScriptDir & "\DelaySets.ini", "Buttons", "Left", GUICtrlRead($InpLBtn))
IniWrite(@ScriptDir & "\DelaySets.ini", "Buttons", "Right", GUICtrlRead($InpRBtn))
IniWrite(@ScriptDir & "\DelaySets.ini", "Buttons", "Key", GUICtrlRead($InpKey))
IniWrite(@ScriptDir & "\DelaySets.ini", "Buttons", "Code", GUICtrlRead($InpCode))
ExitLoop
EndSwitch
Until 0
Global $DownUpDelay = GUICtrlRead($InpDownUp)
Global $ClicksDelay = GUICtrlRead($InpClicks)
Global $FirstDelay = GUICtrlRead($InpFirst)
Global $Left = GUICtrlRead($InpLBtn) = 1
Global $Right = GUICtrlRead($InpRBtn) = 1
Global $Key = GUICtrlRead($InpKey) = 1
Global $Code = GUICtrlRead($InpCode)
Global $Llock, $Rlock, $Klock, $Start = True
GUIDelete($GUI)
HotKeySet("+{F1}", "LOnOff")
HotKeySet("+{F2}", "ROnOff")
HotKeySet("+{F3}", "KOnOff")
HotKeySet("^{F1}", "Llock")
HotKeySet("^{F2}", "Rlock")
HotKeySet("^{F3}", "Klock")
Do
If $Start Then
ClickPress("01")
ClickPress("02")
ClickPress($Code)
EndIf
Sleep(10)
Until 0
Func ClickPress($Btn)
If _IsPressed($Btn) Then
$Timer = TimerInit()
Do
If Not _IsPressed($Btn) Then ExitLoop
Sleep(10)
Until TimerDiff($Timer) > $FirstDelay
If Not _IsPressed($Btn) Then
Return
Else
$tPoint = _WinAPI_GetMousePos()
$hWin = _WinAPI_WindowFromPoint($tPoint)
_WinAPI_ScreenToClient($hWin, $tPoint)
Switch $Btn
Case "01", "02"
Do
Switch $Btn
Case "01"
If $Left Then
LeftDownUp($hWin, $tPoint.X, $tPoint.Y, $DownUpDelay)
Else
If $Llock And Not _IsPressed("01") Then MouseDown("left")
EndIf
Case "02"
If $Right Then
RightDownUp($hWin, $tPoint.X, $tPoint.Y, $DownUpDelay)
Else
If $Rlock And Not _IsPressed("02") Then MouseDown("right")
EndIf
EndSwitch
Until Not _IsPressed($Btn)
$Llock = False
$Rlock = False
Case Else
Do
If $Key Then
KeyPress($hWin, $Btn)
Else
If $Klock And Not _IsPressed($Btn) Then _WinAPI_Keybd_Event("0x" & $Btn, 0)
EndIf
Until Not _IsPressed($Btn)
$Klock = False
EndSwitch
Sleep($ClicksDelay)
EndIf
EndIf
EndFunc
Func LeftDownUp($hWnd, $X, $Y, $Sleep = 0)
_WinAPI_PostMessage($hWnd, $WM_LBUTTONDOWN, 0, _WinAPI_MakeLong($X, $Y))
_WinAPI_PostMessage($hWnd, $WM_SETCURSOR, $hWnd, _WinAPI_MakeLong($HTCLIENT, $WM_LBUTTONDOWN))
Sleep($Sleep)
_WinAPI_PostMessage($hWnd, $WM_LBUTTONUP, 0, _WinAPI_MakeLong($X, $Y))
_WinAPI_PostMessage($hWnd, $WM_SETCURSOR, $hWnd, _WinAPI_MakeLong($HTCLIENT, $WM_LBUTTONUP))
EndFunc
Func RightDownUp($hWnd, $X, $Y, $Sleep = 0)
_WinAPI_PostMessage($hWnd, $WM_RBUTTONDOWN, 0, _WinAPI_MakeLong($X, $Y))
_WinAPI_PostMessage($hWnd, $WM_SETCURSOR, $hWnd, _WinAPI_MakeLong($HTCLIENT, $WM_RBUTTONDOWN))
Sleep($Sleep)
_WinAPI_PostMessage($hWnd, $WM_RBUTTONUP, 0, _WinAPI_MakeLong($X, $Y))
_WinAPI_PostMessage($hWnd, $WM_SETCURSOR, $hWnd, _WinAPI_MakeLong($HTCLIENT, $WM_RBUTTONUP))
EndFunc
Func KeyPress($hWnd, $Code)
_WinAPI_PostMessage($hWnd, $WM_KEYDOWN, "0x" & $Code, 0)
Sleep($DownUpDelay)
_WinAPI_PostMessage($hWnd, $WM_KEYUP, "0x" & $Code, 0)
EndFunc
Func Start()
$Start = Not $Start
EndFunc
Func Quit()
Exit
EndFunc
Func LOnOff()
$Left = Not $Left
EndFunc
Func ROnOff()
$Right = Not $Right
EndFunc
Func KOnOff()
$Key = Not $Key
EndFunc
Func Llock()
$Llock = True
MouseDown("left")
EndFunc
Func Rlock()
$Rlock = True
MouseDown("right")
EndFunc
Func Klock()
$Klock = True
_WinAPI_Keybd_Event("0x" & $Code, 0)
EndFunc