【问题标题】:AutoHotKey - Listen to string after PrintScreen button is pressed?AutoHotKey - 按下 PrintScreen 按钮后收听字符串?
【发布时间】:2015-10-01 02:09:37
【问题描述】:

我希望我的脚本能够监听按下 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

【问题讨论】:

    标签: string paint autohotkey photoshop printscreen


    【解决方案1】:

    你是对的,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
    

    不过,我鼓励您自己查看输入选项,以根据自己的需要进行调整。祝你好运

    【讨论】:

    • 非常感谢,我想我应该查一下输入命令:P
    猜你喜欢
    • 2017-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-07
    • 1970-01-01
    相关资源
    最近更新 更多