Autohotkey - multiple scripts and different language issues

牧云@^-^@ 提交于 2019-12-12 00:43:44

问题


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

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