Sign in to follow this  
Followers 0
Logjammin

SendKeyDownDelay Help Please

5 posts in this topic

Hai, I'm not very good at scripting as you may be able to tell since I can't seem to figure this problem out (even with the help file and plenty of internet searching). I'm trying to use the 'SendKeyDownDelay' command to get Autoit to hold down some keys for me in a toggliing fashion for .4 seconds each. Also to Hold it down for say... 3 minutes as well. What need are just some good (multiple) examples how to use this command to this effect.

Here's what I wrote in my sad unsuccessful attempt and it's toggling the keys too quick:

Send("{a downdelay 400}")

Sleep(50)

Send("{d downdelay 400}")

I know this is wrong

I attempted to space them with a little "sleep" time but it didn't work either. Halp!!

Share this post


Link to post
Share on other sites



You could use

Send ("{a down}")
Sleep (400)
Send ("{a up}")

Share this post


Link to post
Share on other sites

hmm. Would that actually hold down the 'a' key for me for .4 seconds before moving onto the other key using that format?

Share this post


Link to post
Share on other sites

I don't think so. It's just pushing the key but does not send multiple keys event or the scan code of the key as being pushed by the user. You can use this function to do that for you:

Run ('Notepad')
WinWaitActive('Untitled')
_SendKeyDown('a', 2000, 40)




Func _SendKeyDown($sKey, $iTime, $iDelay)
    
    If $sKey == "" Then Return
    $sKey = StringLeft($sKey, 1)
    
    Local $iTmp = Opt('SendKeyDownDelay', $iDelay)
    Local $iInit = TimerInit()
    
    Do
        Send($sKey)
    Until TimerDiff($iInit) > $iTime
    
    Opt('SendKeyDownDelay', $iTmp)
EndFunc

Share this post


Link to post
Share on other sites

Very good, thanks Authenticity

^_^


Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0