Ult902 Posted May 16, 2010 Posted May 16, 2010 ok i have a kotkey set to call a func, which types "a" to make it simple. theres only about 100ms worth of delay in there, but if i hold the hotkey it repeats faster than it should. which is pretty much spamming the func. is there any way to block a func from being called while a func is already running?
Kealper Posted May 16, 2010 Posted May 16, 2010 This should do what you want, I commented everything so you can see what is what (if you didn't already know) HotKeySet("f", "Function") ;Set the key "f" to call function "Function" Global $SpamTimer = TimerInit() ;Initialize a timestamp to $SpamTimer While 1 Sleep(1000) ;Sleep for 1 second to keep the script running idle while nothing is happening WEnd Func Function() If TimerDiff($SpamTimer) < 100 Then Return ;Check if the timestamp in $SpamTimer is more than 100ms old, if not, exit the function without doing anything Send("a") ;Send the keystroke $SpamTimer = TimerInit() ;Put a new timestamp in $SpamTimer EndFunc
CodyBarrett Posted May 16, 2010 Posted May 16, 2010 Nice example. [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
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