Jump to content

SendKeyDownDelay Help Please


Recommended Posts

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!!

Link to comment
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
Link to comment
Share on other sites

  • 1 month later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...