Page 1 of 1

How to bind 1 key to perform 2 key functions

Posted: 11 Jan 2019, 01:12
by TyroNickel
Can someone create a script for me that when I press spacebar it automatically presses W with it please and thank you and I need this for a game League of legends

Re: How to bind 1 key to perform 2 key functions

Posted: 11 Jan 2019, 01:32
by gregster
Welcome to the forum!

Here you go:

Code: Select all

Space::w
Please look at the beginner's tutorial. If this is for a game and not working, please look also here: https://www.autohotkey.com/boards/viewtopic.php?t=11084

Also, next time please post threads like this in the Ask for Help forum, or in its 'Gaming' subforum, if appropriate. Thank you!

Or did you mean Space and w?

Code: Select all

$Space::Send {Space}w
Hope this helps!

Re: How to bind 1 key to perform 2 key functions

Posted: 11 Jan 2019, 01:40
by TyroNickel
umm so when i press space space and w press idk how to explain..

Re: How to bind 1 key to perform 2 key functions

Posted: 11 Jan 2019, 01:45
by gregster
gregster wrote:
11 Jan 2019, 01:32

Code: Select all

$Space::Send {Space}w
This? When you press space, the space and the w key will be sent shortly after each other. Or both pressed down at the same time?

Code: Select all

$Space::Send {Space down}{w down}{w up}{Space up}

Re: How to bind 1 key to perform 2 key functions

Posted: 11 Jan 2019, 01:47
by TyroNickel
Ill try it when i have my pc thank you

Re: How to bind 1 key to perform 2 key functions

Posted: 11 Jan 2019, 02:10
by TyroNickel
a small delay would be okay milliseconds

Re: How to bind 1 key to perform 2 key functions

Posted: 11 Jan 2019, 02:56
by gregster
Delay of what? You are not very precise in your requests...

Code: Select all

$Space::
Send {Space down}{w down}{w up}{Space up}
sleep, 100	; wait 100 milliseconds
return
?
I think you should now try a little bit yourself, with the info from here and the tutorial.
If you have further questions/problems, please show the code you have tried and describe exactly what doesn't work as expected...

Re: How to bind 1 key to perform 2 key functions

Posted: 11 Jan 2019, 09:34
by mast4rwang
~*Space::w
return

~ symbol means the button retains its original function and sends your commands.
* symbol means you can press other buttons while pressing yours and it will still work.