SugarplumChum Posted October 23, 2017 Share Posted October 23, 2017 (edited) I want the ''e'' button to hold down ''s'' and ''f'' when it's down and release ''s'' and ''f'' when its released. What am I doing wrong? HotKeySet("e down","sf1") HotKeySet("e up","sf2") While(1) WEnd Func sf1() Send("{s down}") Send("{f down}") EndFunc Func sf2() Send("{s up}") Send("{f up}") EndFunc Edit: noticed i posted in the wrong section. Edited October 23, 2017 by SugarplumChum Link to comment Share on other sites More sharing options...
SugarplumChum Posted October 23, 2017 Author Share Posted October 23, 2017 I want the ''e'' button to hold down ''s'' and ''f'' when it's down and release ''s'' and ''f'' when its released. What am I doing wrong? HotKeySet("e down","sf1") HotKeySet("e up","sf2") While(1) WEnd Func sf1() Send("{s down}") Send("{f down}") EndFunc Func sf2() Send("{s up}") Send("{f up}") EndFunc Link to comment Share on other sites More sharing options...
aa2zz6 Posted October 23, 2017 Share Posted October 23, 2017 (edited) Does this work? #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep(10) ; If E key is pressed hold key S & F down until E is released If _IsPressed("45", $dll) Then Send("{s down}") ;Holds the s key down Send("{f down}") ;Holds the f key down While _IsPressed("57", $dll) Sleep(10) WEnd EndIf WEnd https://www.autoitscript.com/autoit3/docs/keywords/IfElseEndIf.htm https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm https://www.autoitscript.com/autoit3/docs/functions/Send.htm Edited October 23, 2017 by aa2zz6 SugarplumChum 1 Link to comment Share on other sites More sharing options...
SugarplumChum Posted October 23, 2017 Author Share Posted October 23, 2017 6 minutes ago, aa2zz6 said: Does this work? #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 Sleep(10) ; If E key is pressed hold key S & F down until E is released If _IsPressed("45", $dll) Then Send("{s down}") ;Holds the s key down Send("{f down}") ;Holds the f key down While _IsPressed("57", $dll) Sleep(10) WEnd EndIf WEnd https://www.autoitscript.com/autoit3/docs/keywords/IfElseEndIf.htm https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm https://www.autoitscript.com/autoit3/docs/functions/Send.htm It holds s & f down but they dont get released when i release ''e'' Link to comment Share on other sites More sharing options...
aa2zz6 Posted October 23, 2017 Share Posted October 23, 2017 2 minutes ago, SugarplumChum said: It holds s & f down but they dont get released when i release ''e'' Change the while loop to this: While _IsPressed("45", $dll) Sleep(10) WEnd SugarplumChum 1 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 23, 2017 Moderators Share Posted October 23, 2017 Threads merged, please stick to one in the future. Also, be sure you have read the forum rules to which you were previously pointed; a second thread on gaming would not bode well for you. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
SugarplumChum Posted October 23, 2017 Author Share Posted October 23, 2017 (edited) 57 minutes ago, aa2zz6 said: Change the while loop to this: While _IsPressed("45", $dll) Sleep(10) WEnd Same thing, I have to press s and f for them to be released again when i need them be released on ''e up'' Edited October 23, 2017 by SugarplumChum Link to comment Share on other sites More sharing options...
SugarplumChum Posted October 23, 2017 Author Share Posted October 23, 2017 15 minutes ago, JLogan3o13 said: Threads merged, please stick to one in the future. Also, be sure you have read the forum rules to which you were previously pointed; a second thread on gaming would not bode well for you. Sorry my bad, wont happen again :). Link to comment Share on other sites More sharing options...
aa2zz6 Posted October 23, 2017 Share Posted October 23, 2017 Are you pressing just the "E" key down or are you pressing multiple keys? Link to comment Share on other sites More sharing options...
SugarplumChum Posted October 23, 2017 Author Share Posted October 23, 2017 Just the ''E'' Key Link to comment Share on other sites More sharing options...
SugarplumChum Posted October 23, 2017 Author Share Posted October 23, 2017 https://gyazo.com/d20b3c5a2d56cf66fdf8ddc3c7ecfdd2 Maybe this helps Link to comment Share on other sites More sharing options...
SugarplumChum Posted October 24, 2017 Author Share Posted October 24, 2017 Fixed it =) #include <Misc.au3> $dll = DllOpen("user32.dll") While 1 ; If E key is pressed hold key S & F down until E is released If _IsPressed("45", $dll) Then Send("{s down}") ;Holds the s key down Send("{f down}") ;Holds the f key down While _IsPressed("45", $dll) Sleep(10) WEnd Send("{s up}"); Send("{f up}"); EndIf WEnd Thank you aa2z6 for you help =)! aa2zz6 1 Link to comment Share on other sites More sharing options...
aa2zz6 Posted October 24, 2017 Share Posted October 24, 2017 Glad to help 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