ahk icon indicating copy to clipboard operation
ahk copied to clipboard

ahk.type key delay

Open Apprisco opened this issue 1 year ago • 2 comments

Checked the documentation

describe your feature request

I want AHK to type (not send) emails and passwords for example into a window. Trying to set the key_delay for this isn't working: ahk.type(account.email,key_delay=50)

Apprisco avatar Aug 23 '24 02:08 Apprisco

Obviously I can replicate this with a for loop typing a single key at a time, but that seems wasteful lol.

Apprisco avatar Aug 23 '24 03:08 Apprisco

If you're using AutoHotkey v2, you'll have to change the send mode in order to see the effect of the key_delay parameter take place properly. Keep in mind, AutoHotkey v2 uses Input as its default SendMode. As noted in the SetKeyDelay documentation, key delay has no effect when the SendMode is Input.

Try the following, which sets the send mode to Event, which will allow the key delay to take effect:

from ahk import AHK
ahk = AHK(version='v2')

ahk.send('anything', key_delay=50, send_mode='Event')
# OR
ahk.set_send_mode('Event')
ahk.send('anything', key_delay=50)

When using AutoHotkey v1, this isn't necessary since Event is the default send mode in v1.

Using key delay with .type is, incidentally, not currently supported because it uses SendInput as its implementation (and, as discussed, Input send mode does not support this).

spyoungtech avatar Aug 23 '24 06:08 spyoungtech

If you're using AutoHotkey v2, you'll have to change the send mode in order to see the effect of the key_delay parameter take place properly. Keep in mind, AutoHotkey v2 uses Input as its default SendMode. As noted in the SetKeyDelay documentation, key delay has no effect when the SendMode is Input.

Try the following, which sets the send mode to Event, which will allow the key delay to take effect:

from ahk import AHK
ahk = AHK(version='v2')

ahk.send('anything', key_delay=50, send_mode='Event')
# OR
ahk.set_send_mode('Event')
ahk.send('anything', key_delay=50)

When using AutoHotkey v1, this isn't necessary since Event is the default send mode in v1.

Using key delay with .type is, incidentally, not currently supported because it uses SendInput as its implementation (and, as discussed, Input send mode does not support this).

Hi! Is it possible to send input immediately to certain window? I'm using window.send it's like typing, but I would like to do it as fast as possible

brezq avatar Dec 25 '24 19:12 brezq