user1320651
user1320651

Reputation: 836

ahk sendinput works on button click but not on ^Down

Using Autohotkey, can anyone explain why this isnt working?

    ^Down::
        Gosub, Close
    return

    Close:
        MsgBox CLOOOOSE
        GuiControlGet, editText,, MyEdit
        WinMinimize TemplateEngine
        SendInput, {raw}%editText%
        MsgBox CLOOOOSE
    return

When I use a button

Gui, Add, Button, gClose x30 y44, Close

This works and the SendInput does what I want.

If I use ^Down (CTRL + Arrow Down) the SendInput doesnt do anything

Ive also tried this

^Down::
Close:
    MsgBox CLOOOOSE
    GuiControlGet, editText,, MyEdit
    WinMinimize TemplateEngine
    SendInput, {raw}%editText%
    MsgBox CLOOOOSE
 return

Why does the button click and hotkey end up with different results, even though they call the same actions? Please help

Upvotes: 0

Views: 897

Answers (1)

Robert Ilbrink
Robert Ilbrink

Reputation: 7953

What I tested was:

^Down::
    MsgBox, Cntrl down
    Gosub, Close
    MsgBox, Back to Cntrl Down
return

Close:
    editText=My Message
    MsgBox, CLOSE Subroutine
    SendInput, {raw}%editText%
return

And it shows all the MsgBox alerts and places My Message in Notepad. Not sure what I can do differently. Is the routine is fired correctly on ^Down, but behaves differently?

Upvotes: 1

Related Questions