Shift+space spam only space, instead two keys

Ask gaming related questions (AHK v1.1 and older)
Ahooli
Posts: 5
Joined: 19 Jan 2022, 05:22

Shift+space spam only space, instead two keys

Post by Ahooli » 19 Jan 2022, 05:26

hello, I'm trying to create a script that will spam the space key when the shift key is pressed and the space key is pressed

Code: Select all

+space::
Loop
{
if not GetKeyState("space", "P")
break
SendInput {space down}
Sleep, 10
SendInput {space up}
}
return
in this version, when you press shift + space, it spams two keys at once. and I need to press shift+space, it only spams space. help how to do it?
Last edited by BoBo on 19 Jan 2022, 05:28, edited 1 time in total.
Reason: Added [code][/code]-tags.

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

Re: Shift+space spam only space, instead two keys

Post by mikeyww » 19 Jan 2022, 07:35

Welcome to this AutoHotkey forum!

Code: Select all

$+Space::
While GetKeyState("Space", "P")
 Send {Space}
Return

Ahooli
Posts: 5
Joined: 19 Jan 2022, 05:22

Re: Shift+space spam only space, instead two keys

Post by Ahooli » 19 Jan 2022, 07:42

mikeyww wrote:
19 Jan 2022, 07:35
Welcome to this AutoHotkey forum!

Code: Select all

$+Space::
While GetKeyState("Space", "P")
 Send {Space}
Return
this not working. this script just spam shift+space. im need when i hold Shift+space spam ONLY space. and when i hold only space spam only space)

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

Re: Shift+space spam only space, instead two keys

Post by mikeyww » 19 Jan 2022, 07:58

Code: Select all

$Space::
$+Space::
Send {Blind}{Shift up}{RShift up}
While GetKeyState("Space", "P")
 Send {Space}
Return

Ahooli
Posts: 5
Joined: 19 Jan 2022, 05:22

Re: Shift+space spam only space, instead two keys

Post by Ahooli » 19 Jan 2022, 08:13

mikeyww wrote:
19 Jan 2022, 07:58

Code: Select all

$Space::
$+Space::
Send {Blind}{Shift up}{RShift up}
While GetKeyState("Space", "P")
 Send {Space}
Return
when I hold space for a long time and then release it, he presses shift many times. I don't know if I have a problem. In any case, thank you very much. But it still doesn't work as it should. Even with a short press on space, shift is pressed. I do not need it.

To be honest, I'm even ashamed to ask for help. You already wrote two scripts for me.

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

Re: Shift+space spam only space, instead two keys

Post by mikeyww » 19 Jan 2022, 08:20

Code: Select all

$Space::
$+Space::
Send {Blind}{Shift up}{RShift up}
While GetKeyState("Space", "P")
 Send {Space}
KeyWait, Shift
SoundBeep, 1000
Return

Ahooli
Posts: 5
Joined: 19 Jan 2022, 05:22

Re: Shift+space spam only space, instead two keys

Post by Ahooli » 19 Jan 2022, 08:24

mikeyww wrote:
19 Jan 2022, 08:20
When I tried this in Notepad and then examined the KeyHistory, that is not what I found. Shift was not pressed at any time. In any case, others may have some better scripts or ideas for you. Best wishes.
How did you check it in notepad?
I check it through KeyTest on the website https://key-test.ru/

Am I wrong, and the site is not working correctly?

Ahooli
Posts: 5
Joined: 19 Jan 2022, 05:22

Re: Shift+space spam only space, instead two keys

Post by Ahooli » 19 Jan 2022, 08:37

mikeyww wrote:
19 Jan 2022, 08:20

Code: Select all

$Space::
$+Space::
Send {Blind}{Shift up}{RShift up}
While GetKeyState("Space", "P")
 Send {Space}
KeyWait, Shift
SoundBeep, 1000
Return
It's hard to understand if my message is being moderated, or it hasn't even been sent...
I wanted to ask how you checked the pressing of the shift?
But there was a problem. The script almost works. the fact is that when you press shift and after that (without releasing shift) you press space, the shift is released. And I don't need it. But the script already works almost as it should. thanks a lot

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

Re: Shift+space spam only space, instead two keys

Post by mikeyww » 19 Jan 2022, 10:24

I changed my earlier post because I thought of the KeyWait after my initial reply.

The Shift is intentionally released because you said you wanted Space to be sent, not Shift+Space. You even said the following earlier.
Even with a short press on space, shift is pressed. I do not need it.
An additional option for you is below.

Code: Select all

$Space::
$+Space::
While GetKeyState("Space", "P")
 Send {Blind}{Space}
KeyWait, Shift
SoundBeep, 1000
Return

Post Reply

Return to “Gaming Help (v1)”