1

I want my script to listen to the string I will enter after the PrintScreen button is pressed. For example, if I press the PrintScreen button and type "paint" afterwards, it should open MSPaint. If I however type "photoshop", it should open Photoshop.. Is this possible?

Here is my attempt, a completely failure (I'm new to AHK by the way..)

~PrintScreen::paint::
    Run, MSPaint
    WinWaitActive, Untitled - Paint
    Send, ^v
return

~PrintScreen::photoshop::
    Run, Photoshop
    WinWaitActive, Adobe Photoshop CS6
    Send, ^v
return
Dean
  • 301
  • 1
  • 3
  • 13

1 Answers1

1

well you are right, printScreen::paint:: is no valid AutoHotkey code.

Make use of Ahk's Input command instead - it was made to listen for strings / characters:

~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

I however encourage you to have a look at input's options yourself to adjust it to your needs. Good luck

phil294
  • 10,038
  • 8
  • 65
  • 98