问题
I use autohotkey to simplify copying, using Alt+W instead of Ctrl+C. However, I often switch my keyboard to a Hebrew layout, so the w key is now the ' key. Then the autohotkey script for w doesn't work.
I tried to write a second script into the same file but it doesn't get activated when I press Alt+' when I'm in the Hebrew layout. I'm not sure whether it's my syntax or something else, any ideas?
This is my code:
!w::
Send, {ctrl down}{a down}{a up}{c down}{c up}{ctrl up}
return
!'::
Send, {ctrl down}{a down}{a up}{c down}{c up}{ctrl up}
return
Thanks!
回答1:
It is worth to try to use the virtual/scan codes of keys, instead names, This example uses the virtual code (vkXX):
;~ SetKeyDelay, keyDelay:=25, pressDuration:=25 ; details for SendEvent mode.
!vk57:: ; w/'/я... (en/he/ru...)
Send, {CtrlDown}{vk41}{vk43}{CtrlUp}
KeyWait, vk57
;~ Do something by release this key, if necessary...
Return
回答2:
Catching Alt-' with the code you used works in other keyboard layouts (like the German layout) so your syntax looks OK to me.
To solve your problem I'd start the autohotkey help file. Read "List of Keys, Mouse Buttons, and Joystick Controls" where the section on "Special Keys" explains how to attempt to catch inrecognized keys via the "keyboard hook".
Basically it describes how to find out the !' scancode which you then can use as a hotkey alternative.
来源:https://stackoverflow.com/questions/16582145/autohotkey-multiple-scripts-and-different-language-issues