Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ahk.type key delay #340

Open
1 task done
Apprisco opened this issue Aug 23, 2024 · 2 comments
Open
1 task done

ahk.type key delay #340

Apprisco opened this issue Aug 23, 2024 · 2 comments

Comments

@Apprisco
Copy link

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
Copy link
Author

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

@spyoungtech
Copy link
Owner

spyoungtech commented Aug 23, 2024

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants