Two step autoclicker Topic is solved

Ask gaming related questions
Nichlas
Posts: 2
Joined: 08 Sep 2023, 04:01

Two step autoclicker

28 Jan 2024, 10:12

I have created an autoclicker that starts with one left mouse-click followed by a 3500 ms sleep, then 30 left mouse-clicks with 200 ms sleep
in between.

It is started by the hotkey Ctrl+f, and script is exited with Ctrl+o.

Can someone help me add in a hotkey to stop the (outer) loop instead of exiting the script? Preferably I would like Ctrl+f to also stop, but otherwise another hotkey, like Ctrl+g would also work for me

Code: Select all

#Requires AutoHotkey v2.0
on := False

^o::ExitApp ; Hotkey to exit script

^f:: {
    Loop 1000 {
        click
        Sleep 3500
        Loop 30 {
            Click
            Sleep 200
        }
    }
}
User avatar
Noitalommi_2
Posts: 309
Joined: 16 Aug 2023, 10:58

Re: Two step autoclicker  Topic is solved

28 Jan 2024, 13:02

Hi.

A simple solution would be to just use Reload, this will exit and restart the script.

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance

^o::ExitApp
^g::Reload
^f:: {

	Loop 1000 {

		Click
		Sleep 3500
		Loop 30 {

			Click
			Sleep 200
		}
	}
}
Another solution could be to use a toggle.

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance

^o::ExitApp
^g::{

	global on := false
}
^f:: {

	global on := true
	Loop 1000 {

		if !on
			break
		Click
		Sleep 3500
		Loop 30 {

			if !On
				break 2
			Click
			Sleep 200
		}
	}
}
Last edited by Noitalommi_2 on 30 Jan 2024, 00:23, edited 1 time in total.
Nichlas
Posts: 2
Joined: 08 Sep 2023, 04:01

Re: Two step autoclicker

29 Jan 2024, 16:41

I really like your second solution, as I will be able to "clean up" when exiting the loop if needed.

Thanks!
User avatar
Noitalommi_2
Posts: 309
Joined: 16 Aug 2023, 10:58

Re: Two step autoclicker

30 Jan 2024, 12:53

On the second thought, splitting the 3500ms sleep with a loop might be a good idea, as 3.5s is quite long and using until makes the skript a little bit shorter.

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance

^o::ExitApp
^g::{

	global on := false
}
^f:: {

	global on := true
	Loop 1000 {

		Click
		Loop 35
			Sleep 100
		until !on

		Loop 30
			Click(), Sleep(200)
		until !on

	}until !on
}

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 5 guests