Jump to content
Sign in to follow this  

Random Keypress help

Recommended Posts

Hi everyone great forum you have here, I'm having a bit a trouble though what I want autoit to do is send a random keypress out of like 4 selected keys so for example: space, w, s, d, a and it would randomly pick one

Would the code be someting like this:

Send((Random({"w" "s" "d" "a"})))

or am I completely off here? sorry if its completely wrong still learning ;) any help would be appreciated

Share this post

Link to post
Share on other sites

Wow, those look a lot like movement keys (wasd)

but assuming they are not and it was just a poor example...


if $key=1 then


elseif $key=2 then


elseif $key=3 then


elseif $key=4 then


elseif $key=5 then



that will only run once, to make it run more than that it needs to go into a function being called from the main script when needed, or put in a loop

Also you could use switch...case instead of if...esleif



My Android cat and mouse game

We're gonna need another Timmy!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...