Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SetControlDelay -1
- totalTimers := 0
- ; add or subtract as many hotkeys as you'd like
- ; the first parameter of toggleTimer needs to be between 1 and maxTimers
- maxTimers := 3
- ; the second parameter is the delay between mouse clicks
- ; the third parameter is an optional flag that'll add holding down control as the mouse click is being sent
- f6:: toggleTimer(1, 90)
- f7:: toggleTimer(2, 2000, 1)
- f8:: toggleTimer(3, 75)
- ; hover over the window and place you want the mouse clicks to go then press the hotkey to start the clicks at that spot in that window
- f9:: pause ; pauses timers
- f10:: reload ; turns off timer
- toggleTimer(timerID, timerInterval, lvl = 0)
- {
- global
- bTimer%timerID% := bTimer%timerID% ? false : true
- if (bTimer%timerID%)
- {
- MouseGetPos X%timerID%, Y%timerID%, actWin%timerID%
- timerInterval%timerID% := timerInterval
- lvl%timerID% := lvl
- prevTime%timerID% := 0
- totalTimers++
- if totalTimers = 1
- SetTimer, timerLoop, -1
- }
- else
- totalTimers--
- }
- timerLoop:
- loop
- {
- loop %maxTimers%
- {
- if (bTimer%A_Index% and A_TickCount - prevTime%A_Index% > timerInterval%A_Index%)
- {
- if lvl%A_Index%
- ControlSend,, {ctrl down}, % "ahk_id " actWin%A_Index%
- ControlClick, % "x" X%A_Index% " y" Y%A_Index%, % "ahk_id " actWin%A_Index%,,,, NA
- if lvl%A_Index%
- ControlSend,, {ctrl up}, % "ahk_id " actWin%A_Index%
- prevTime%A_Index% := A_TickCount
- }
- }
- if (!totalTimers)
- return
- sleep 1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement