How to tell which line is executing without using msgbox?
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
How to tell which line is executing without using msgbox?
Sometimes when changing the sequence of my few thousand liner script, the hotkeys go wonky and I have to ctrl+F to find the most possible Combination that has a bug. Does AHK have a tool to let me know which line it is executing when i hit the hotkey in a context sensitive environment ?
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to tell which line is executing without using msgbox?
yeah but I don't wanna insert a tooltip/msgbox in every part of my master script. Is there an alternative?
Re: How to tell which line is executing without using msgbox?
You may know this already, but you can double-click on the script’s icon in the system tray to view the most recently executed lines.
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to tell which line is executing without using msgbox?
For instance, I have this line in both scripts that are active and running:
Code: Select all
ScrollLock::reload
Re: How to tell which line is executing without using msgbox?
Only one script actually executed that line, so no tracking of lines being executed will help point you to the issue. The issue is that when one script intercepts the press of the ScrollLock key, that keypress is no longer available for the other script to act on. You need at least one script to not "eat" that key but to allow it to pass through as it acts on it (i.e., to allow it to retain its native function). That will allow the other script to see it and have its hotkey triggered. Try changing that line in one of the scripts to this:milkygirl90 wrote: ↑ For instance, I have this line in both scripts that are active and running:However only 1 script reloads. The most recent executed lines does not show the line being executed. How do I debug this then?Code: Select all
ScrollLock::reload
Code: Select all
~ScrollLock::reload
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to tell which line is executing without using msgbox?
Now only the script with the ~ reloads.boiler wrote: ↑18 Jun 2021, 21:37Only one script actually executed that line, so no tracking of lines being executed will help point you to the issue. The issue is that when one script intercepts the press of the ScrollLock key, that keypress is no longer available for the other script to act on. You need at least one script to not "eat" that key but to allow it to pass through as it acts on it (i.e., to allow it to retain its native function). That will allow the other script to see it and have its hotkey triggered. Try changing that line in one of the scripts to this:milkygirl90 wrote: ↑ For instance, I have this line in both scripts that are active and running:However only 1 script reloads. The most recent executed lines does not show the line being executed. How do I debug this then?Code: Select all
ScrollLock::reload
Code: Select all
~ScrollLock::reload
Funny thing is, when I have this code, it reloads both scripts (but I also want it to work outside of notepad):
Code: Select all
#If WinActive("ahk_class Notepad++") ; Auto reload script upon saving it
~^s::reload
return
Re: How to tell which line is executing without using msgbox?
I doubt it has to do with the #If directive. It probably has more to do with the choice of hotkey. Try using a different hotkey than ScrollLock, at least for a test. I get the same hotkey to work in two different scripts simultaneously with that approach in my testing.
You could also try leaving it with ScrollLock but add ~ to both scripts. That might mean that your actual ScrollLock toggle state will change when you press the hotkey, which may or may not be an issue for you.
You could also try leaving it with ScrollLock but add ~ to both scripts. That might mean that your actual ScrollLock toggle state will change when you press the hotkey, which may or may not be an issue for you.
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to tell which line is executing without using msgbox?
I noticed if I add ~ to both scripts, I can't use the following lines below for both scripts either:boiler wrote: ↑18 Jun 2021, 22:12I doubt it has to do with the #If directive. It probably has more to do with the choice of hotkey. Try using a different hotkey than ScrollLock, at least for a test. I get the same hotkey to work in two different scripts simultaneously with that approach in my testing.
You could also try leaving it with ScrollLock but add ~ to both scripts. That might mean that your actual ScrollLock toggle state will change when you press the hotkey, which may or may not be an issue for you.
Code: Select all
^Scrolllock::Suspend
Re: How to tell which line is executing without using msgbox?
Did you try adding ~ before those hotkeys as well?
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to tell which line is executing without using msgbox?
It might again be a quirk relative to your choice of hotkey.