kevilay Posted May 20, 2005 Posted May 20, 2005 ok im tring to make this basic program thingy for fun and i never tried holding down a key. this basic expamle of what i mean while 1 Send("{space}") ; i want it to hold down this space for 3 secs sleep(1000) wend I seen the opt("holdkeydown") or w/e command but i didnt know how to use it. Can someone show me what i have to do please. Thanks Kevin,
GaryFrost Posted May 20, 2005 Posted May 20, 2005 ok im tring to make this basic program thingy for fun and i never tried holding down a key. this basic expamle of what i meanwhile 1Send("{space}") ; i want it to hold down this space for 3 secssleep(1000)wendI seen the opt("holdkeydown") or w/e command but i didnt know how to use it. Can someone show me what i have to do please.Thanks Kevin,<{POST_SNAPBACK}>you mean something like?Run("notepad") WinWait("Untitled - Notepad") WinActivate("Untitled - Notepad") $timer = TimerInit() while 1 Send("{space}"); i want it to hold down this space for 3 secs If(TimerDiff($timer) > 3000) then ExitLoop WEnd SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
therks Posted May 20, 2005 Posted May 20, 2005 No, I think that will tap the space key for 3 seconds. Try this: Send('{space down}') Sleep(3000) My AutoIt Stuff | My Github
GaryFrost Posted May 20, 2005 Posted May 20, 2005 (edited) No, I think that will tap the space key for 3 seconds.Try this:Send('{space down}') Sleep(3000)<{POST_SNAPBACK}> already tried that and other variations, the timer worked, couldn't find anything to hold it down for 3 seconds, just keep tapping it for 3 secondsthe keydowndelay will hold the keydown, but doesn't space for that time.Edit: the above loop would only give you 3 spaces. Edited May 20, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
therks Posted May 20, 2005 Posted May 20, 2005 So you're saying the down keyword doesn't work? ... What's the use of it then? My AutoIt Stuff | My Github
GaryFrost Posted May 20, 2005 Posted May 20, 2005 (edited) So you're saying the down keyword doesn't work? ... What's the use of it then?<{POST_SNAPBACK}>No it does hold it down, just doesn't work in the way your thinking it would work, not like when we hit the key and hold it down.It is worth something, showed someone else how to use it when sending alot of text to word, without setting the delay the cpu was at 98%, set a delay of about 10ms instead of 5ms and the cpu usage dropped below 50%.Edit: correction it was KeyDelay in that example, either way not going to work for this. Edited May 21, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
kevilay Posted May 21, 2005 Author Posted May 21, 2005 how would i use it with the key down delay? it might work cause its for a game
GaryFrost Posted May 21, 2005 Posted May 21, 2005 how would i use it with the key down delay? it might work cause its for a game<{POST_SNAPBACK}>Opt("SendKeyDownDelay",3000)Send("{SPACE}") SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
kevilay Posted May 21, 2005 Author Posted May 21, 2005 (edited) Opt("SendKeyDownDelay",3000)Send("{SPACE}")<{POST_SNAPBACK}>ok lemme try it and get back to youEDIT: Works Thanks so much Edited May 21, 2005 by kevilay
KFUPM Posted May 15, 2016 Posted May 15, 2016 On ٢١/٥/٢٠٠٥ at 4:13 AM, GaryFrost said: Opt("SendKeyDownDelay",3000) THANK YOU. God, why isn't this part mentioned in the send key doc ? Many programs cannot register a key press reliably - if at all - without it. It could save people a lot of time and nerve damage. While searching this problem I found tons of threads with the same exact problem with no solution, I almost gave up thinking it can't be done directly with AutoIt, and I'm sure many people actually did. Sorry for the necro by the way, had to vent.
Bowmore Posted May 15, 2016 Posted May 15, 2016 It already is in the help documentation for Send() https://www.autoitscript.com/autoit3/docs/functions/Send.htm Quote Opt("SendKeyDelay",...) alters the the length of the brief pause in between sent keystrokes.Opt("SendKeyDownDelay",...) alters the length of time a key is held down before being released during a keystroke.Set both "SendKeyDelay" and "SendKeyDownDelay" to 0 to remove all delays when sending keystrokes. This may be required under certain circumstances, for example, when locking the system ("#l") it may be necessary to remove the delays in order to prevent the WIN key from being stuck down. "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook
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