Jump to content

Left vs Right shifting keys & HotKeySet

Recommended Posts


Just getting started with AutoIT. I've noticed that with a Ctrl-Alt-X HotKeySet (where "X" is any key), it only seems to work when I use the left Ctrl-Alt keys and not the right ones.

Like: hotkeyset("^!k","_Test")

I don't seem to have that problem with Shift-Alt-X, but I do with Shift-Ctrl-X. and Ctrl-X I'm guessing there's something special about he Ctrl Key?

What amazingly obvious think am I missing?


Thanks again for helping me get going.


Edit: More experimentation shows a definite difference between the right and left Ctrl keys.  This:

HotKeySet("^{F11}", "_TestFunc")

(where _TestFunc() is simply SEND("Some Test String"))

Always works with left-ctrl-F11. With right-ctrl-F11, it only sends part of the string, always the end (usually about the last 2-5 characters). Also, it leaves my Ctrl key in a down state (I can tell because when I go to a browser window and mouse-scroll up/down, the browser window's zoom % changes). That state remains unchanged until I press the LEFT Ctrl key. Finally, with right-ctrl-F11 I get a "ding", which who knows where THAT is coming from. That all seems really weird, but maybe not for anyone who knows this stuff well.


EDIT2: Turns out the shift keys are affected by the "stickiness", but only sometimes. It seems that if the function uses
AutoITSetOption("SendKeyDelay",100) to slow down the simulated key pressings, the shift key remains down (again, provable by left-clicking in 2 places in a Notepad file.. the text between those 2 places is highlighted, as happens when one shift-clicks).

At this point, I really hope I'm doing something very wrong, or that my hardware has some kind of anomaly which needs some special setting change to address... otherwise I'm rather disappointed so far in AutoIT. I'm confident enough that I'm doing something wrong to keep plugging away for now, however.


Meantime: Hello? Any input from anyone? 40+ reads and no reply? C'mon.. help a newbie brother out LOL



HotKeySet("+{F9}", "_TestFunc")

Edited by SQLDave
Additional info

Share this post

Link to post
Share on other sites

Same problem for me.  Did you ever solve it?


Share this post

Link to post
Share on other sites

Look at the options under "Send" for the L and R CTRL key.  You may have better luck specifically targeting each CTRL key separately.

Share this post

Link to post
Share on other sites

From my experience the issue is in the sending of a command, and that Autoit send function is too quick for the application receiving the sent keys. You will see with the following example that you can use the hotkey with either Ctrl and it will activate the script:


HotKeySet("^{F12}","_test") ; - Trigger test() when ctrl+F12 is pressed

while True

Func _test()




The best solution when trying to send keyboard presses is to use delays such as "Sleep(X)". Where X is the value of the delay in ms.

Typically a delay of 200 to 500 ms before using the send command is enough to fix the problem. You'll have to experiment a bit.


Hope that helps if you haven't already got it working!

Edited by AnonymousX

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now