Help With Random WSAD Keypresses

Get help with using AutoHotkey and its commands and hotkeys
HTWingNut
Posts: 3
Joined: 23 Jul 2019, 11:17

Help With Random WSAD Keypresses

Post by HTWingNut » 23 Jul 2019, 11:21

I'm totally new to AutoHotKey, well I shouldn't say that, I fussed with it ages ago, but looking to send random WSAD key presses.

I found this link https://autohotkey.com/board/topic/106754-how-do-i-make-a-random-key-press/

And provides this script:

Code: Select all

arr := ["w", "a", "s", "d"]

$q::
Random, oVar, 1, 4						
sendinput % arr[oVar]
return
Save it as an AHK file, compile it, and run it, and it does... nothing.

Do I have to do something special, or how do I know that it's actually running?

Thanks.
Last edited by HTWingNut on 23 Jul 2019, 11:39, edited 1 time in total.

swagfag
Posts: 4092
Joined: 11 Jan 2017, 17:59

Re: Help With Random WSAD Keypresses

Post by swagfag » 23 Jul 2019, 11:39

if a Image shows up in the tray or notification area, u know its running
if u want to find out whether its doing the thing its supposed to be doing:
  • dont compile it, run it as an .ahk file, double click the icon -> view lines most recently executed
  • make a hotkey, eg w::listlines and press it
  • add Menu, Tray, MainWindow to ur script which enables listlines in a compiled script

HTWingNut
Posts: 3
Joined: 23 Jul 2019, 11:17

Re: Help With Random WSAD Keypresses

Post by HTWingNut » 23 Jul 2019, 11:40

Thanks for taking time to respond. I think I'm figuring it out....

HTWingNut
Posts: 3
Joined: 23 Jul 2019, 11:17

Re: Help With Random WSAD Keypresses

Post by HTWingNut » 23 Jul 2019, 13:56

Ok, one more thing.

Just trying to get a random number to input a space.

I use:

Code: Select all

Random, Rnd1, 1, 6

if (Rnd1 = 5) send {space}
But compiling it says "unexpected {"

swagfag
Posts: 4092
Joined: 11 Jan 2017, 17:59

Re: Help With Random WSAD Keypresses

Post by swagfag » 23 Jul 2019, 14:12

place send on the next line

User avatar
evilC
Posts: 4787
Joined: 27 Feb 2014, 12:30

Re: Help With Random WSAD Keypresses

Post by evilC » 24 Jul 2019, 06:06

HTWingNut wrote:
23 Jul 2019, 11:21
Save it as an AHK file, compile it, and run it, and it does... nothing.

Do I have to do something special, or how do I know that it's actually running?
Press the q key to send a random character

Post Reply

Return to “Ask For Help”