Repeated key presses whilst held down Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Regath
Posts: 4
Joined: 13 Dec 2018, 13:06

Repeated key presses whilst held down

13 Dec 2018, 13:17

Hello,

So I made a script that'd repeatedly press my mouse at random intervals and it works really well. I wanted to do the same thing for the button e, but that doesn't seem to work and I can't figure out why.

Code: Select all

#SingleInstance force
Suspend

LButton::
	While GetKeyState("Lbutton","P")
	{
		Send {LButton}
		Random, a, 16, 46
		Sleep, %a%
	}
return

e::
	While GetKeyState("e","P")
	{
		Send {e}
		Random, b, 6, 29
		Sleep, %b%
	}
return

	XButton1::
		Suspend
return

The left mouse button works perfectly fine, but my e button doesn't. If someone could point out what I did wrong, I'd really appreciate it.
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Repeated key presses whilst held down  Topic is solved

13 Dec 2018, 17:45

Add a $ in your first line.
$e::

And you don't need the {} for this key.

Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
Regath
Posts: 4
Joined: 13 Dec 2018, 13:06

Re: Repeated key presses whilst held down

13 Dec 2018, 21:48

Scr1pter wrote:
13 Dec 2018, 17:45
Add a $ in your first line.
$e::

And you don't need the {} for this key.

Regards

Yep, it works perfectly now. Thank you. :)

Code: Select all

#SingleInstance force
Suspend

LButton::
	While GetKeyState("Lbutton","P")
	{
		Send {LButton}
		Random, a, 16, 46
		Sleep, %a%
	}
return

$e::
	While GetKeyState("e","P")
	{
		Send, e
		Random, a, 16, 46
		Sleep, %a%
	}
return

	XButton1::
		Suspend
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: DataLife, Google [Bot], pgeugene, Rohwedder and 90 guests