SteeLpwnage Posted April 6, 2010 Share Posted April 6, 2010 I want this to press certain buttons when some hot key is pressed for an example in this script I want it to when I press w it simulates that i pressed w and clicks the left mouse (wherever the cursor's at) and etc i need it to do the same thing just different letters on w it presses w on a it presses a and etc. so can some1 please remodulate this code I need it to work in any window that is open $a = ('1') While $a = ('1') If _IsPressed(57) = 1 Then Send('w') MouseClick("left") EndIf If _IsPressed(41) = 1 Then Send('a') MouseClick("left") EndIf If _IsPressed(44) = 1 Then Send('d') MouseClick("left") EndIf If _IsPressed(53) = 1 Then Send('s') MouseClick("left") EndIf WEnd Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 6, 2010 Share Posted April 6, 2010 (edited) I've shortened the code a bit, so only the first two letters are there, but this is basically it. Take out the 'ExitLoop' lines if this has to loop continuously. #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep(100) If _IsPressed("57", $dll) Then Send('w') MouseClick("left") ExitLoop EndIf If _IsPressed("41", $dll) Then Send('a') MouseClick("left") ExitLoop EndIf WEnd Edited April 6, 2010 by snowmaker - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
SteeLpwnage Posted April 6, 2010 Author Share Posted April 6, 2010 thank u very much Link to comment Share on other sites More sharing options...
ShawnW Posted April 6, 2010 Share Posted April 6, 2010 (edited) 1st basic question, what is $a = ('1') for. If you need an infinite loop just do While True. 2nd, since I see wasd I am assuming you want to click while moving in a game. And with multiple calls in a row to determine if the button is still pressed you would probably open the "user32.dll" as suggested in the help for _IsPressed(), and pass its handle. Look at the example in the manual. #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep ( 250 ) If _IsPressed("23", $dll) Then MsgBox(0,"_IsPressed", "End Key Pressed") ExitLoop EndIf WEnd DllClose($dll) Edit: oh someone posted reply already doh Edit again: although I would put DllClose($dll) at the end Edited April 6, 2010 by ShawnW Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 6, 2010 Share Posted April 6, 2010 Edit again: although I would put DllClose($dll) at the endOops, I forgot to put that in.. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
SteeLpwnage Posted April 7, 2010 Author Share Posted April 7, 2010 The first reply worked gr8 anyway thx again Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 7, 2010 Share Posted April 7, 2010 Yes, it should, and I guess it does, work, but it should have the dllclose line at the end. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now