Jump to content
ji7saw

simple scripts - hold two buttons

Recommended Posts

ji7saw

hi, I want a simple script that holding two buttons ('W' 'D').

Share this post


Link to post
Share on other sites
Moonscarlet

Hi,

See Send() function.

  • Like 1

Share this post


Link to post
Share on other sites
AutoBert
Posted (edited)

First step is done, you know what you want. Next step read in helpfile and after just do it.

Edited by AutoBert
  • Like 1

Share this post


Link to post
Share on other sites
ji7saw

for now I have something like:

#z::
    SEND w
    send d
    Return
z Up::
    SEND w
    send d
    Return
    

 

but when I click "z" it clicks' w 'd' only once.
How to make it loop?

Share this post


Link to post
Share on other sites
FrancescoDiMuro

@ji7saw
Hi and welcome to the AutoIt forum :)
Since you are new, I higly reccomend to you to read Forum Rules and Forum Etiquette, in which it is clearely stated:

Quote

Usually asking for a script is not taken too well, within reason. Keep in mind that this is a support forum, so please acknowledge that. We are here to help you with your scripts, not to spoon-feed code to you.

Then, for what purpose are you sending those keys?
Thanks.


Best Regards.
 


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
HardXOR

try this

Send("{W down}", 0)
Send("{D down}", 0)
...
do your stuff
...
Send("{W up}", 0)
Send("{D up}", 0)

with _IsPressed you can check if key is down or up

#include <Misc.au3>

$hDLL = DllOpen("user32.dll")

Send("{W down}", 0)
Sleep(1000)
ConsoleWrite("key pressed " & _IsPressed(Hex(Asc("W")), $hDLL) & @CRLF)
Sleep(1000)
Send("{W up}", 0)
Sleep(1000)
ConsoleWrite("key pressed " & _IsPressed(Hex(Asc("W")), $hDLL) & @CRLF)

DllClose($hDLL)

 

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

×