Trying to get a macro to work while holding a key down

Ask gaming related questions (AHK v1.1 and older)
Vexicus
Posts: 1
Joined: 07 Dec 2022, 15:36

Trying to get a macro to work while holding a key down

Post by Vexicus » 07 Dec 2022, 15:40

Hello!

I'm trying to get a jumping macro to press space every 20ms while pressing down LAlt, regardless of what else is being held on the keyboard.
So far I can't even seem to get this macro to play work properly on it's own, what am I doing wrong?

Code: Select all

*0::
While GetKeyState(LAlt, "P") 
{
	Send, Space
	Sleep, 200
	Send, Space
	Sleep, 200
}
Return

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]

User avatar
mikeyww
Posts: 26595
Joined: 09 Sep 2014, 18:38

Re: Trying to get a macro to work while holding a key down

Post by mikeyww » 07 Dec 2022, 18:47

Functions use expressions.
Literal strings must be enclosed in double quotes to distinguish them from variables.
Example

Post Reply

Return to “Gaming Help (v1)”