mark-wiemer-org / ahkpp

AutoHotkey Plus Plus (AHK++) - AutoHotkey v1 and v2 support for VS Code
https://marketplace.visualstudio.com/items?itemName=mark-wiemer.vscode-autohotkey-plus-plus
Other
152 stars 10 forks source link

Debugger takes keyboard focus from active window #418

Open steveja42 opened 7 months ago

steveja42 commented 7 months ago

Description

Debugger takes keyboard focus from active window

Reproduction steps

Steps to reproduce the behavior:

  1. Open Notepad
  2. Click on "debug AHK script button" in vscode with the following script
    caption := "Untitled" 
    WinActivate (caption)
    WinWaitActive  (caption, 10)
    OutputDebug "done waiting"
    Sleep 2000 ; wait for page to load and be ready for input
    SendEvent "snafu"

Expected behavior

Expected:"snafu" is typed into the notepad window. Instead it is typed to the debugger expression eval window If I comment out

Sleep 2000 ; wait for page to load and be ready for input

then it behaves as expected. Using version 2.

fade2gray commented 7 months ago

Just a thought, if you create your script using a blank editor tab and then click the debug button, you are prompted to save the script - the default name will have "Untitled" in it, e.g. "Untitled-1.ahk".

I tried the above, and it sends "snafu" to the editor window unless you change the name of the script.

SendEvent "snafu"snafu