Page 1 of 1
Debugging in VSCode
Posted: 14 Feb 2024, 20:41
by Sundog
I have a simple AHK v2 script that controls another application via key presses. Example:
Code: Select all
Send "A"
Send "{Tab}{Tab}"
Send " "
Send "B"
I have VSCode installed and the debugger seems to be working, but when I add a breakpoint, it focuses my script in VSCode and applies the command to that script (IE it adds the letter A to line one of the script, 2 tabs to line 2 of the script, etc.). Is there a way to keep the application I want to control (eg a blank notepad) in focus while allowing me to step through the code?
[Mod edit: Moved from 'Ask for Help (v2)' since question is editor-related.]
Re: Debugging in VSCode
Posted: 14 Feb 2024, 21:41
by boiler
This is why I don’t use a debugger for a lot of my AHK coding because it often interacts with other windows. There are other ways to leave a popcorn trail of what is getting executed and when, such as inserting ToolTip, MsgBox (focus usually returns to the window that had it when it is dismissed or times out), and SoundBeep calls into key points of your code.
Re: Debugging in VSCode
Posted: 21 Feb 2024, 20:08
by Sundog
Thanks! I've done a lot with Tooltips and Message boxes, but I was hoping for a more streamlined way. I will play around with your other suggestions.
Re: Debugging in VSCode
Posted: 21 Feb 2024, 23:07
by thqby
You can also use
OutputDebug or debugger instructions.
Code: Select all
var := 'msg'
;@Debug-Output => {var}
Re: Debugging in VSCode
Posted: 10 Mar 2024, 03:20
by jsong55
@thqby
jsong55 wrote: ↑09 Mar 2024, 21:38
Any native AHK capability can do this?
How to Console.WriteLine to the VSCode console?
Got ideas?
Re: Debugging in VSCode
Posted: 10 Mar 2024, 05:59
by thqby
Code: Select all
OutputDebug(str '`n')
FileAppend(str '`n', '*')
Re: Debugging in VSCode
Posted: 10 Mar 2024, 19:04
by jsong55
Without going into debug?
Re: Debugging in VSCode
Posted: 11 Mar 2024, 11:32
by thqby
Using OutputDebug in debugging.
Output to stdout FileAppend(str '`n', '*') at any time.
Re: Debugging in VSCode
Posted: 11 Mar 2024, 11:46
by wilkster
Re: Debugging in VSCode
Posted: 12 Mar 2024, 11:25
by jsong55