AHK GetKeyState use? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
makac

AHK GetKeyState use?  Topic is solved

24 Jun 2017, 13:12

Hello! I need some help with a script I am trying to make.

What I am trying to achieve:

Upon press of "r", I want the script to check if the "Space" is down (not physically, but from a previous "Send {Space D}" command), and if so do nothing. But if "Space" is Up, then "Send Space".

I tried something like this, but it doesn't seem to work:

r::
GetKeyState, state, Space
if state = U
Send {Space D}.
return

Please help
robertcollier4
Posts: 33
Joined: 09 Apr 2016, 22:14

Re: AHK GetKeyState use?

24 Jun 2017, 14:12

Send {Space D} is only the Down but will not send a Space because the Space is sent on the Up. So you want to send the Down and the Up:

Code: Select all

Send {Space}
Also, check out the following, it may help for what you are trying?

Code: Select all

#MaxThreadsPerHotkey,1 ; no re-entrant hotkey handling
https://autohotkey.com/docs/commands/_M ... Hotkey.htm - #MaxThreadsPerHotkey - Sets the maximum number of simultaneous threads per hotkey

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 320 guests