Dsmoeg999 Posted April 7, 2023 Share Posted April 7, 2023 Hi guys can someone guide me it seems that my code runs in a loop and does not work correctly. #include <Misc.au3> #include <MsgBoxConstants.au3> Local $hDLL = DllOpen("user32.dll") While 1 ;_IsPressed("51", $hDLL) equals Letter Q Do Beep(500, 1000) Sleep(2000) Until _IsPressed =_IsPressed("51", $hDLL) WEnd DllClose($hDLL) Link to comment Share on other sites More sharing options...
Solution Dan_555 Posted April 7, 2023 Solution Share Posted April 7, 2023 Maybe because you have 2 nested loops: While 1 ... Do .. Until ... Wend When you exit out of the do loop, it loops forever again in the while loop. Here is a solution: #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") $hTime = TimerInit() Do If TimerDiff($hTime) > 2000 Then Beep(500, 1000) $hTime = TimerInit() EndIf Until _IsPressed("51", $hDLL) DllClose($hDLL) Dsmoeg999 1 Some of my script sourcecode Link to comment Share on other sites More sharing options...
Dsmoeg999 Posted April 7, 2023 Author Share Posted April 7, 2023 Thank you very much for the clarification and the example greetings☺️ 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