SendInput won't work at high speed

人走茶凉 提交于 2019-12-20 06:39:47

问题


I have made a shortcut saying "alt j" goes one left with the arrows, like this:

!j::SendInput,{LEFT}

This works fine, except if I hold down "alt j" for too long. It will work fine most of the time but occasionally dropping small "j"s around the path im going. Say i Wanna go one letter at a time, through this sentence:

"Hello world"

it'll most likely become something like this:

"jHeljjlo jworljd"

Is there a way to put a tiny delay on every keystroke to make it able to keep up? or is this problem related to a default delay which has to be set down maybe?

Thanks for your help!


回答1:


So this is still an issue for you? Looks to me like an AutoHotkey bug most likely, or wrongly sent js because your RAM can't handle the heavy programs well enough.

Things I can think of that you could try:

  • buy a better computer.

  • use setBatchLines, 1ms, making your script sleep 20ms each milli second and therefore consuming less cpu. This might clear AutoHotkey's mind.

  • SetKeyDelay, 50 might also help.

Sometimes, a pressed down modifier such as ctrl or alt, slows down windows drastically. This was at least the case under Windows Vista. So you might wanna get rid of the ! (alt) and stick to the j instead: the following script gets activated by !j and behaves just like your initial script, but will also keep running once you release ALT, as long as J is pressed down:

!j::
sendInput {left}
hotkey, *j, sendLeft, ON
hotkey, *j up, stopSendLeft, ON
return

sendLeft:
send {left}
return

stopSendLeft:
hotkey, *j, sendLeft, OFF
hotkey, *j up, stopSendLeft, OFF
return

Still, I don't have high hopes any of this will help you.



来源:https://stackoverflow.com/questions/28462561/sendinput-wont-work-at-high-speed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!