UltraTM Posted August 25, 2016 Share Posted August 25, 2016 First Hello @all im finally registered Thx to the Admin Joe i played also with aut.....ey and autoit. For me autoit is very nice and i made allready some crazy testing stuff with it hehe But one thing i cant get to work for testing. (Im not making an Bot or anything for an game) I really want to know how something can be done in autoit: in the other thing its like this: *Pause:: ; Pause Taste für pausieren bei einem Fehler evtl. Suspend Pause,,1 return *End:: ; Ende Taste beenden des Keybinders ExitApp return *F:: ; Taste F Loop { Send, {a Down} ;Solange gedrückt drückt er a und d abwechselnd bis man die Taste loslässt zwecks 2 Tasten Funktion etwas anders Sleep, 150 Send, {a Up} Send, {d Down} Sleep, 150 Send, {d Up} }until !GetKeyState("F","P") ;überprüfen ob F oder P losgelassen wurde return ;Tastenklicker Ende Its only about to detect an button is pressed as long as its pressed a function run and when its released it stops. I got it working with an hotkey to start stop with the same key finally But im stuck there. Its really only for testing and learning with simple things first clicking buttons. And one is 2 Keys which should be an loop. If i would get that running i could start doing more complex stuff. But still cant get only keys work Thats what i made for testing: While 1 If _IsPressed("46", $dll) Then $pressed = True $test = True ConsoleWrite("_IsPressed - Shift Key was pressed." & @CRLF) ;MsgBox(0, "Pressed", $pressed) ; Wait until key is released. While _IsPressed("46", $dll) Sleep(250) WEnd $pressed = False $test = False ConsoleWrite("_IsPressed - Shift Key was released." & @CRLF) EndIf Sleep(250) WEnd Func _start () While 1 If $pressed = True Then ;Wenn die Variable $aktiv an ist, dann soll Send ("{a down}") Sleep(150);die Taste Space gesendet werden Send ("{a up}") Send ("{d down}") Sleep(150);die Taste Space gesendet werden Send ("{d up}") EndIf WEnd EndFunc Im really trying to convert the code first to understand how its working in autoit. Since the GetKeyState is gone. Greetings Link to comment Share on other sites More sharing options...
Developers Jos Posted August 25, 2016 Developers Share Posted August 25, 2016 (edited) 4 minutes ago, UltraTM said: Thx to the Admin Joe Joe? 4 minutes ago, UltraTM said: But one thing i cant get to work for testing. (Im not making an Bot or anything for an game) Denying something without being asked first normally means the opposite ... right? Jos Edited August 25, 2016 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
UltraTM Posted August 25, 2016 Author Share Posted August 25, 2016 Yes sorry was not able to edit it. Its only cause i also posted it in the german autoit section. And it was being deletet cause of programming a bot... For me this are simply functions to also learn. GUI and that is also nice played with it allready Link to comment Share on other sites More sharing options...
Developers Jos Posted August 25, 2016 Developers Share Posted August 25, 2016 Ok, let me be clear with you: Make sure you read our forumrules and sick to them and you'll be fine. Jos UltraTM 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
UltraTM Posted August 25, 2016 Author Share Posted August 25, 2016 OK and thank you very much to be a part of the community Link to comment Share on other sites More sharing options...
TheDcoder Posted August 25, 2016 Share Posted August 25, 2016 39 minutes ago, UltraTM said: Thx to the Admin Joe I think you mean Old Master @Jos! 40 minutes ago, UltraTM said: aut.....ey ??? aut.... wht? EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Developers Jos Posted August 25, 2016 Developers Share Posted August 25, 2016 (edited) 1 minute ago, TheDcoder said: ??? aut.... wht? Think and you'll know! Edited August 25, 2016 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
UltraTM Posted August 25, 2016 Author Share Posted August 25, 2016 Yes the Yedi Master autohotkey Link to comment Share on other sites More sharing options...
TheDcoder Posted August 25, 2016 Share Posted August 25, 2016 Just now, Jos said: Think and you'll know! @UltraTM has saved me from some thinking EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
UltraTM Posted August 25, 2016 Author Share Posted August 25, 2016 but btw. Maybe someone could help how i could get this running a function as long as an button is pressed when i insert it in the is_pressed the while. Then its always running and dont get into the check if its still pressed or not. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 25, 2016 Developers Share Posted August 25, 2016 I assume this isn't the total script as this is missing lines at the beginning? When I add them the trigger with the F key is working fine, so what exactly is the problem? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
UltraTM Posted August 25, 2016 Author Share Posted August 25, 2016 Hi, expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\Downloads\dead_by_daylight___icon_by_blagoicons_da5g2xm_il1_icon.ico #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_Language=1031 #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #include <Misc.au3> #include <MsgBoxConstants.au3> ;Hotkeys HotKeySet ("{f}", "_wechseln") ;Startet die Funktion "_wechseln" beim klicken auf die Pause Taste HotKeySet ("{END}", "_ende") ;Beendet das Script ;Hotkeys End Global $aktiv = False ;Deklariere die Variable beim start Global $pressed = False Global $test = False Func _wechseln () ; Funktion _wechseln If $aktiv = False Then ;Wechseln des Zustandes der Variable: $aktiv = True ;Wenn sie an ist, dann soll sie aus werden Else ;wenn das nicht zutrifft, dann $aktiv = False ;soll sie aus gehen EndIf ;ende der "Wenn" abfrage EndFunc ;ende der Funktion ;Function start with f and end with f again ;While ; If $aktiv = True Then ;Wenn die Variable $aktiv an ist, dann soll ; Send("{a down}") ;Hält a unten ; Sleep(Random(800, 1100 , 1)) ; Send("{a up}") ;Lässt a los ; Sleep(Random(10,30, 1)) ; Send("{d down}") ;Hält d unten ; Sleep(Random(800, 1100 , 1)) ; Send("{d up}") ;Läst d los ; Sleep(Random(10,30, 1));die Taste Space gesendet werden ; EndIf ;ende der "Wenn" abfrage ;WEnd While 1 If _IsPressed("46") Then $pressed = True $test = True _start() ConsoleWrite("_IsPressed - F Key was pressed." & @CRLF) ;MsgBox(0, "Pressed", $pressed) ; Wait until key is released. While _IsPressed("46") Sleep(250) WEnd $pressed = False $test = False ConsoleWrite("_IsPressed - F Key was released." & @CRLF) EndIf Sleep(250) WEnd Func _start () While 1 If $pressed = True Then ;Wenn die Variable $aktiv an ist, dann soll Send ("{a down}") Sleep(150);die Taste Space gesendet werden Send ("{a up}") Send ("{d down}") Sleep(150);die Taste Space gesendet werden Send ("{d up}") EndIf WEnd EndFunc Func _stop () $test = False EndFunc Func _ende () ;Funktion zum beenden Exit ;beenden des Skriptes EndFunc Thats the actual complete one. Where i tried to start a function when pressing the button f it starts but never stops cause he didnt read anymore the code after _start() Thats where im stuck. How to use functions there. to start the function when f button pressed and stop a function when f button released. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 25, 2016 Developers Share Posted August 25, 2016 Get rid of the HotKeySet for the F key as you now want to do 2 things at different places! Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
UltraTM Posted August 25, 2016 Author Share Posted August 25, 2016 when i delete it and test it in the editor for example he writes also f and start adadadad but doesnt stop when releasing. Im to stupid for this tried many different ways but cant find the correct one Link to comment Share on other sites More sharing options...
Developers Jos Posted August 25, 2016 Developers Share Posted August 25, 2016 No idea what you are on about, so please simply talk about what you have posted and its result or else you simply confuse the hell out of me. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
UltraTM Posted August 25, 2016 Author Share Posted August 25, 2016 ok so this is the base function to detect key is pressed and released: While 1 If _IsPressed("46") Then ConsoleWrite("_IsPressed - F Key was pressed." & @CRLF) ;MsgBox(0, "Pressed", $pressed) ; Wait until key is released. While _IsPressed("46") Sleep(250) WEnd ConsoleWrite("_IsPressed - F Key was released." & @CRLF) EndIf Sleep(250) WEnd I only want to know how can i start a function when F Key is pressend and end the function when F key is released for example. This now only gives me a console message to see ok key pressed and key released. argumentum 1 Link to comment Share on other sites More sharing options...
UltraTM Posted August 26, 2016 Author Share Posted August 26, 2016 ok here an example code ive found: #include <misc.au3> While 1 If _IsPressed(04) Then ;04 is Middle Click Send("{SPACE}") While _IsPressed(04) ;04 is Middle Click Sleep(10) WEnd EndIf Sleep(10) WEnd Problem when press middle mouse it presses 1x space. How can i make it pressing Space so long until i release the middle mouse button? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 26, 2016 Developers Share Posted August 26, 2016 25 minutes ago, UltraTM said: How can i make it pressing Space so long until i release the middle mouse button? That really shouldn't be too hard to figure out when you actually put in the effort to try and understand the posted snippet. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
UltraTM Posted August 26, 2016 Author Share Posted August 26, 2016 I cant get it even grrr. The best solution what im looking for is how to start a function as long as its pressed. think thats why i cant get it work. In my head theres always start a function with it. but then it runs. And the function is also a while loop and it never checks the key released again Link to comment Share on other sites More sharing options...
TheDcoder Posted August 26, 2016 Share Posted August 26, 2016 @UltraTM This should print 4 digit random numbers as long as you hold the middle mouse button! #include <misc.au3> While 1 If _IsPressed(04) Then ;04 is Middle Click While _IsPressed(04) ;04 is Middle Click ConsoleWrite(Random(1000, 9999, 1) & @CRLF) WEnd EndIf Sleep(10) WEnd EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion 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