小编Bow*_*wen的帖子

条件热键或包含在 AutoHotKey 中

有没有办法在 AutoHotKey 中有条件地定义热键?我想为不同物理键盘的不同机器做不同的键盘映射。

这就是我想要做的:

RegRead, ComputerName, HKEY_LOCAL_MACHINE, System\CurrentControlSet\Control\ComputerName, ComputerName
If ( ComputerName = BDWELLE-DIM8300 ) 
{
 #Include %A_ScriptDir%\Mappings-BDWELLE-DIM8300.ahk
}
Run Code Online (Sandbox Code Playgroud)

或者

RegRead, ComputerName, HKEY_LOCAL_MACHINE, System\CurrentControlSet\Control\ComputerName, ComputerName
If ( ComputerName = BDWELLE-DIM8300 ) 
{
 LWin::LAlt
    [more hotkey definitions that only apply to this machine]
}
Run Code Online (Sandbox Code Playgroud)

但是由于 AHK 在解释 If 语句之前解析 Hotkey 定义和 #Include 语句,因此 Hotkeys 定义(无论是否隐藏在 #Include 中)不尊重 If 条件。

感谢您将我指向 AutoHotKey_L!

您是否有关于如何有条件地定义热键的具体示例?语法非常混乱。这是我正在尝试的(在安装 AutoHotKey_L.exe 代替 AutoHotKey.exe 之后):

RegRead, ComputerName, HKEY_LOCAL_MACHINE, System\CurrentControlSet\Control\ComputerName, ComputerName 
#If ( ComputerName = BDWELLE-DIM8300 ) 
LWin::LAlt 
Run Code Online (Sandbox Code Playgroud)

但这似乎不起作用......

windows remapping autohotkey

5
推荐指数
1
解决办法
3217
查看次数

标签 统计

autohotkey ×1

remapping ×1

windows ×1