我正在尝试重新映射蓝牙遥控器上的一些按钮,以便与一些艺术节目一起使用。我有一个适用于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语句时(如代码块(上面)中所示)按下并立即释放。
有没有办法实现这个目标?
答案 0 :(得分:0)
这会使用context-sensitive hotkeys实现您的脚本,并避免使用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