Page 1 of 1

AHK did not press 70 UP keys for me

Posted: 03 Jun 2018, 12:07
by kwfine
Hi all,

I am using Version v1.1.23.03 in WIndows 7 and 10.

This is my custom simple function:

Code: Select all

test(howmany){
 Send, {UP %howmany%}
}
but I found that, when I put in a large number, for example 70 as in test(70),
AHK did not really press 70 UP keys for me. I figured out only 36 UP keys were pressed.

Could you tell me why this happened?

Thank you!

Kitty

Re: AHK did not press 70 UP keys for me  Topic is solved

Posted: 03 Jun 2018, 12:15
by wolf_II
I figured out only 36 UP keys were pressed.
Maybe you were unable to count correctly, while AHK did sent 70 keypresses.
Maybe you counted correctly and 36 is all that was sent by AHK.

Unless you tell us also how you counted, my guess is conform with the first possibility.

Re: AHK did not press 70 UP keys for me

Posted: 03 Jun 2018, 12:21
by wolf_II
I tested the following script:

Code: Select all

F12:: test(70)
test(howmany) {
 Send, {UP %howmany%}
}
It sends 70 keypresses of UP-arrows. I counted as follows:

Run the script.
Open Notepad++ with a file containing ~2500 lines.
move the text cursor to the end of line 2000.
Press F12.
check the position of the text cursor.
Result: 1930

Re: AHK did not press 70 UP keys for me

Posted: 03 Jun 2018, 12:26
by gregster
Not every program might be able to process all 70 key presses in a short time.

Re: AHK did not press 70 UP keys for me

Posted: 04 Jun 2018, 07:09
by evilC
What is telling you that only 36 got pressed?
Add SetKeyDelay, 0, 50 to the start of the script, re-run. Does it now say 70?

I bet that the reason you think it is sending half that amount is that the app is polling keys rather than responding to events, and due to the frequency of it's polling loop, only sees every other key pressed.