根据键在键盘上的位置而不是按键触发的字符重新映射键
Remap key based on its position on the keyboard, not on the character a keypress triggers
我将英语键盘设置为德语。所以我使用的不是 qwerty,而是 qwertz。当我将键盘切换回英语时,我希望使用默认的英语键盘,字符 y 和 z 除外,因为我已经习惯用德语输入这些字符,以至于在更改布局时总是把它们弄混。
所以我正在寻找像这样的脚本:
If keypress is third row, 7th key:
Change output to z
If keypress is fifth row, 2nd key:
Change output to y
另一种方法是根据英语布局进行更改:
If keyboard-layout is english:
if keypress is y:
Change output to z
if keypress is z:
Change output to y
试试这个:
#If (GetKeyboardLanguage(WinActive("A")) = 0x0409) ; english (german = 0x0407)
z::y
y::z
#If
GetKeyboardLanguage(_hWnd=0){
if !_hWnd
ThreadId=0
else
if !ThreadId := DllCall("user32.dll\GetWindowThreadProcessId", "Ptr", _hWnd, "UInt", 0, "UInt")
return false
if !KBLayout := DllCall("user32.dll\GetKeyboardLayout", "UInt", ThreadId, "UInt")
return false
return KBLayout & 0xFFFF
}
https://www.autohotkey.com/board/topic/116538-detect-which-language-is-currently-on/#entry672236
您可以根据扫描码重新映射:
SC15::z
SC2C::y
扫描代码不取决于您的键盘布局或其他任何布局。
另请注意,您可能没有与我相同的扫描码。
您可以自己找到我们的扫描码,例如GetKeySC()
(docs) or by using the keyhistory.
我将英语键盘设置为德语。所以我使用的不是 qwerty,而是 qwertz。当我将键盘切换回英语时,我希望使用默认的英语键盘,字符 y 和 z 除外,因为我已经习惯用德语输入这些字符,以至于在更改布局时总是把它们弄混。 所以我正在寻找像这样的脚本:
If keypress is third row, 7th key:
Change output to z
If keypress is fifth row, 2nd key:
Change output to y
另一种方法是根据英语布局进行更改:
If keyboard-layout is english:
if keypress is y:
Change output to z
if keypress is z:
Change output to y
试试这个:
#If (GetKeyboardLanguage(WinActive("A")) = 0x0409) ; english (german = 0x0407)
z::y
y::z
#If
GetKeyboardLanguage(_hWnd=0){
if !_hWnd
ThreadId=0
else
if !ThreadId := DllCall("user32.dll\GetWindowThreadProcessId", "Ptr", _hWnd, "UInt", 0, "UInt")
return false
if !KBLayout := DllCall("user32.dll\GetKeyboardLayout", "UInt", ThreadId, "UInt")
return false
return KBLayout & 0xFFFF
}
https://www.autohotkey.com/board/topic/116538-detect-which-language-is-currently-on/#entry672236
您可以根据扫描码重新映射:
SC15::z
SC2C::y
扫描代码不取决于您的键盘布局或其他任何布局。
另请注意,您可能没有与我相同的扫描码。
您可以自己找到我们的扫描码,例如GetKeySC()
(docs) or by using the keyhistory.