venezia Posted August 28, 2005 Share Posted August 28, 2005 Hi all, Is there a function to stop a loop until I press a key ? The script looks like that: Do ................. ................ .................... ...................... Until "Escape is pressed" Regards Link to comment Share on other sites More sharing options...
BigDod Posted August 28, 2005 Share Posted August 28, 2005 How about #include <IsPressed.au3> While 1 Sleep(100) If _IsPressed('1B') = 1 Then MsgBox(0, "Mouse x,y:","ESC has been Pressed") ExitLoop EndIf WEnd Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
venezia Posted August 28, 2005 Author Share Posted August 28, 2005 How about#include <IsPressed.au3> While 1 Sleep(100) If _IsPressed('1B') = 1 Then MsgBox(0, "Mouse x,y:","ESC has been Pressed") ExitLoop EndIf WEnd<{POST_SNAPBACK}>Auto it tells me that there's a mistake with the following line:If _IsPressed('1B') = 1 ThenWhat is the reason ? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 28, 2005 Developers Share Posted August 28, 2005 Auto it tells me that there's a mistake with the following line:If _IsPressed('1B') = 1 ThenWhat is the reason ?<{POST_SNAPBACK}>Use HotKeySet ... that's supported without an UDF... or look up the UDF _IsPressed() and include the code.... (will be part of the Next Beta installer) 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...
venezia Posted August 28, 2005 Author Share Posted August 28, 2005 (edited) Use HotKeySet ... that's supported without an UDF... or look up the UDF _IsPressed() and include the code.... (will be part of the Next Beta installer)<{POST_SNAPBACK}>I tried HotKeySet("ESC", "ExitLoop") without successBut this one works perfectly even if it's quite brutal While 1 ...................................... ...................................... HotKeySet("{ESC}", "Terminate") WEnd Func Terminate() Exit 0 EndFuncThnak you very much all Edited August 28, 2005 by venezia Link to comment Share on other sites More sharing options...
LegacyWeapon Posted August 28, 2005 Share Posted August 28, 2005 You don't need to set the hotkey each time the loop runs... Link to comment Share on other sites More sharing options...
LxP Posted August 28, 2005 Share Posted August 28, 2005 More specifically, this will also work for you: hotkeySet("{ESC}", "terminate") while 1 ··· ··· ; don't forget a short delay! sleep(100) wEnd func terminate() exit endFunc 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