Page 1 of 1

For a simple CTRL+AX, should I make it longer so that AHK will have enough time to process?

Posted: 03 Jun 2018, 13:01
by kwfine
Hi all,


For a simple CTRL+AX, should I make it longer so that AHK will have enough time to process?
I have used AHK for 2 years, but sometimes a simple code still confused me like this:

Code: Select all

Send, {CTRLDOWN}ax{CTRLUP}

Code: Select all

Sleep, 100
Send, {CTRLDOWN}
Sleep, 100
Send, ax
Sleep, 100
Send, {CTRLUP}
Sleep, 100
OR

Code: Select all

Sleep, 100
Send, {CTRL DOWN}
Sleep, 100
Send, ax
Sleep, 100
Send, {CTRL UP}
Sleep, 100

Thanks!


Kitty

Re: For a simple CTRL+AX, should I make it longer so that AHK will have enough time to process?

Posted: 03 Jun 2018, 13:23
by Exaskryz
It isn't necessarily that AHK needs time to process, but the target program does. AHK can send input to a program too fast for it to handle at times.

You can try to avoid interlacing the Sleep, 100 by instead using SetKeyDelay.

CTRLDOWN isn't a key, but CTRL is. You can use Send {Ctrl Down} and Send {Ctrl Up}. So the last bit of code you used looks right; the first code, as a single line, needs the spaces between the L and D and the L and U.