Photoshop 在 AHK 之前获取输入
Photoshop picks up input before AHK
几年前写过如下脚本:
#IfWinActive ahk_class Photoshop
#Wheelup::
Send, {vkDD}
return
#IfWinActive ahk_class Photoshop
#WheelDown::
Send, {vkDB}
return
当我在按下 win 键的同时向上或向下滚动鼠标时,此脚本会生成输入“[”或“]”。这个脚本运行良好,但现在,当我安装 photoshop 2020 时,它无法运行。我以为 ahk_class 已经改变了,但事实并非如此。当我删除 ifWinActive 行时,脚本将字符发送到记事本,但不会将它们发送到 photoshop。此外,我的其他 bingings 在 Photoshop 处于活动状态时也不起作用。
我应该怎么做才能解决这个问题?
如果 Photoshop 是 运行 管理员权限,那么 AHK 将不会拦截按键,这很可能是这个问题背后的原因。
如果是这种情况,请尝试 运行 AHK 脚本作为管理员,方法是将此添加到 auto-execute section(脚本顶部):
; If the script is not elevated, relaunch as administrator and kill current instance:
full_command_line := DllCall("GetCommandLine", "str")
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
try ; leads to having the script re-launching itself as administrator
{
if A_IsCompiled
Run *RunAs "%A_ScriptFullPath%" /restart
else
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
}
ExitApp
}
有关详细信息,请阅读 https://autohotkey.com/docs/commands/Run.htm#RunAs。
几年前写过如下脚本:
#IfWinActive ahk_class Photoshop
#Wheelup::
Send, {vkDD}
return
#IfWinActive ahk_class Photoshop
#WheelDown::
Send, {vkDB}
return
当我在按下 win 键的同时向上或向下滚动鼠标时,此脚本会生成输入“[”或“]”。这个脚本运行良好,但现在,当我安装 photoshop 2020 时,它无法运行。我以为 ahk_class 已经改变了,但事实并非如此。当我删除 ifWinActive 行时,脚本将字符发送到记事本,但不会将它们发送到 photoshop。此外,我的其他 bingings 在 Photoshop 处于活动状态时也不起作用。 我应该怎么做才能解决这个问题?
如果 Photoshop 是 运行 管理员权限,那么 AHK 将不会拦截按键,这很可能是这个问题背后的原因。
如果是这种情况,请尝试 运行 AHK 脚本作为管理员,方法是将此添加到 auto-execute section(脚本顶部):
; If the script is not elevated, relaunch as administrator and kill current instance:
full_command_line := DllCall("GetCommandLine", "str")
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
try ; leads to having the script re-launching itself as administrator
{
if A_IsCompiled
Run *RunAs "%A_ScriptFullPath%" /restart
else
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
}
ExitApp
}
有关详细信息,请阅读 https://autohotkey.com/docs/commands/Run.htm#RunAs。