AutoHotKey - 在按下 PrintScreen 按钮后收听字符串?
AutoHotKey - Listen to string after PrintScreen button is pressed?
我想让我的脚本监听按下 PrintScreen 按钮后我将输入的字符串。例如,如果我按下 PrintScreen 按钮并随后键入 "paint",它应该会打开 MSPaint。但是,如果我输入 "photoshop",它应该会打开 Photoshop。这可能吗?
这是我的尝试,完全失败了(顺便说一下,我是 AHK 的新手..)
~PrintScreen::paint::
Run, MSPaint
WinWaitActive, Untitled - Paint
Send, ^v
return
~PrintScreen::photoshop::
Run, Photoshop
WinWaitActive, Adobe Photoshop CS6
Send, ^v
return
你是对的,printScreen::paint::
不是有效的 AutoHotkey 代码。
改为使用 Ahk 的 Input 命令 - 它用于侦听字符串/字符:
~PrintScreen::
input, outputString, i, {enter}.{esc}{tab}
if outputstring = paint
{
Run, MSPaint
WinWaitActive, Untitled - Paint
Send, ^v
} else if outputstring = photoshop
{
Run, Photoshop
WinWaitActive, Adobe Photoshop CS6
Send, ^v
}
return
不过,我鼓励您自己查看输入的选项,以根据您的需要进行调整。祝你好运
我想让我的脚本监听按下 PrintScreen 按钮后我将输入的字符串。例如,如果我按下 PrintScreen 按钮并随后键入 "paint",它应该会打开 MSPaint。但是,如果我输入 "photoshop",它应该会打开 Photoshop。这可能吗?
这是我的尝试,完全失败了(顺便说一下,我是 AHK 的新手..)
~PrintScreen::paint::
Run, MSPaint
WinWaitActive, Untitled - Paint
Send, ^v
return
~PrintScreen::photoshop::
Run, Photoshop
WinWaitActive, Adobe Photoshop CS6
Send, ^v
return
你是对的,printScreen::paint::
不是有效的 AutoHotkey 代码。
改为使用 Ahk 的 Input 命令 - 它用于侦听字符串/字符:
~PrintScreen::
input, outputString, i, {enter}.{esc}{tab}
if outputstring = paint
{
Run, MSPaint
WinWaitActive, Untitled - Paint
Send, ^v
} else if outputstring = photoshop
{
Run, Photoshop
WinWaitActive, Adobe Photoshop CS6
Send, ^v
}
return
不过,我鼓励您自己查看输入的选项,以根据您的需要进行调整。祝你好运