Mazdryk Posted October 6, 2013 Share Posted October 6, 2013 I have a hotkey that runs a function for me that takes around 1 second to finish. The problem is that I like to spam my hotkey and the func gets lagged and back logged and trys to run many instances at once. How can I press a hotkey for a func and not allow that hotkey to run the func again until its first run is over? Link to comment Share on other sites More sharing options...
JohnOne Posted October 6, 2013 Share Posted October 6, 2013 HotkeySet("x", "_HotFunc") Func _HotFunc() HotkeySet("x") ;do stuff HotkeySet("x", "_HotFunc") EndFunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Mazdryk Posted October 6, 2013 Author Share Posted October 6, 2013 HotkeySet("x", "_HotFunc") Func _HotFunc() HotkeySet("x") ;do stuff HotkeySet("x", "_HotFunc") EndFunc Doesn't work; it still allows me to run the function and the hotkey is still active and can be spammed. Link to comment Share on other sites More sharing options...
somdcomputerguy Posted October 6, 2013 Share Posted October 6, 2013 The problem is that I like to spam my hotkey..Well I guess a simple solution would be to not spam the hotkey. - 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...
Developers Jos Posted October 6, 2013 Developers Share Posted October 6, 2013 (edited) Doesn't work; it still allows me to run the function and the hotkey is still active and can be spammed. Don't understand, so what about showing some code that has this problem! Here is some code that demonstrates you can only run the Func one time and pressing the x constantly doesn't influence the execution of _HotFunc hotkeySet("x", "_HotFunc") hotkeySet("{END}", "_EndFunc") While 1 Sleep(50) WEnd ; Func _HotFunc() HotkeySet("x", "_DummyFunc") ConsoleWrite("Start _HotFunc():") For $x = 1 To 100 ConsoleWrite(".") Sleep(10) Next ConsoleWrite("End _HotFunc()" & @CRLF) HotkeySet("x", "_HotFunc") EndFunc Func _DummyFunc() Return EndFunc ; Func _EndFunc() Exit EndFunc Jos Edited October 6, 2013 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...
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