我正在尝试重新映射蓝牙遥控器上的一些按钮,以便与一些艺术程序一起使用。我有一个适用于 Photoshop 等的工作脚本,但我想改变 Artrage 的键,我相信我已经成功了。但是,我也希望能够按住并释放密钥(而不是让它按下并立即释放。
这是我的代码:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#InstallKeybdHook
SetTimer, WatchWin, 2000 ;Checks the window every 2 seconds
WatchWin:
WinGetActiveTitle, ActiveTitle
If ActiveTitle Contains Photoshop, CameraRaw_WindowClass, CLIP STUDIO PAINT, ArtRage
{
Volume_Up::]
Volume_Down::[
Media_Prev::^z
Media_Next::^+z
Media_Play_Pause::
If ActiveTitle Contains ArtRage
Send, +c
Else
Send, i
Return
;Browser_Home::Space
;Volume_Mute::Space
}
Return
如果我Media_Play_Pause
定义为 Media_Play_Pause::i
,Windows 会将其视为按住,直到我释放按钮,但是当它有 If 语句时(如在上面的代码块中(似乎按下并立即释放。
有没有办法做到这一点?
这会使用上下文相关的热键实现脚本,并避免使用send
:
SetTitleMatchMode 2 ; All #If statements match anywhere in title
#IfWinActive Photoshop
#IfWinActive CameraRaw_WindowClass
#IfWinActive CLIP STUDIO PAINT
Volume_Up::]
Volume_Down::[
Media_Prev::^z
Media_Next::^+z
Media_Play_Pause::i
#IfWinActive ArtRage
Volume_Up::]
Volume_Down::[
Media_Prev::^z
Media_Next::^+z
Media_Play_Pause::+c
#IfWinActive