Script Sending Unwanted Keystrokes Topic is solved

Ask gaming related questions (AHK v1.1 and older)
gamer142
Posts: 4
Joined: 30 Jul 2021, 16:25

Script Sending Unwanted Keystrokes

Post by gamer142 » 30 Jul 2021, 16:36

I've written a rather simple script that essentially sends 3 keystrokes with lots of random delays involved. The issue I am experiencing is that the script is sending keystrokes that I have not programmed and that are ruining the script's functionality. The only keystrokes I want to be sent are Escape, Left Mouse Button, and 2, but it also appears to send U, P, 0, Shift, and Spacebar as well throughout the runtime.

Any ideas on how to prevent this and what is causing this? I apologize if this has been addressed before but I couldn't find any resources on the issue. Thank you in advance.

Code: Select all

#SingleInstance Force

End::
loop , 5 {

Random , var1 , 62 , 91
Random , var2 , 290401 , 300599
Random , var3 , 43 , 98
Random , var4 , 121 , 599
Random , var5 , 55, 87
Random , var6 , 51, 101
Random , var7 , 49, 100

Send {Escape down}
Sleep , var3
Send {Escape up}

Sleep , var6

MouseClick, Left, , , , , D,
Sleep , var1
MouseClick, Left, , , , , U,

Sleep, var7

Send {2 down}
Sleep , var5
Send {2 up)


Sleep var2

}

SoundBeep, 800, 100
SoundBeep, 750, 100
SoundBeep, 800, 100
SoundBeep, 825, 200


Return

#b::
ExitApp
Return
gregster
Posts: 8921
Joined: 30 Sep 2013, 06:48

Re: Script Sending Unwanted Keystrokes  Topic is solved

Post by gregster » 30 Jul 2021, 16:49

You have a typo in line 28:

Code: Select all

Send {2 up)
The wrong/missing closing brace } causes it to send u, p, space and a few shifted keys.
gamer142
Posts: 4
Joined: 30 Jul 2021, 16:25

Re: Script Sending Unwanted Keystrokes

Post by gamer142 » 30 Jul 2021, 16:52

gregster wrote:
30 Jul 2021, 16:49
You have a typo in line 28:

Code: Select all

Send {2 up)
The wrong/missing closing brace } causes it to send u, p and a few shifted things.
Haha oh of course. Classic. That would have taken me ages to find. The whole thing works like a charm now. Thank you!
gregster
Posts: 8921
Joined: 30 Sep 2013, 06:48

Re: Script Sending Unwanted Keystrokes

Post by gregster » 30 Jul 2021, 16:54

Happy to help!
That the script sent u and p (= up) made me look for it, after I missed it at first sight. :D
Post Reply

Return to “Gaming Help (v1)”