OnWarn

Propose new features and changes
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

OnWarn

31 Oct 2018, 01:22

- I literally had this idea just now.
- The WarningMode for #Warn could point to a function. And the function would receive the debug info and could then take appropriate action.
- E.g. I would set it up to record previous debug messages, filtering out repeated info (e.g. an undeclared variable at line X), and append certain messages to a file, and show a Progress window and/or play a SoundBeep based on certain conditions.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: OnWarn

10 Nov 2018, 17:02

Some of the warnings are shown before any script (static initializers and the auto-execute section) are executed. These and all other warnings can be handled by an external process using the StdOut method or a DBGp client using the OutputDebug method.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: OnWarn

10 Nov 2018, 18:34

- Ah yes, those initial messages would be missed.
- I'll have to perfect this:
retrieve OutputDebug text - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=58069
- And/or resolve this:
#Warn: get StdOut from another script - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=58985
- Thanks.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: OnWarn

15 Nov 2018, 07:25

- Actually, an OnWarn function would still be useful if it missed initial errors, in the same way that OnError does.
- I don't mind using DebugView to test scripts when they load, but keeping a script/program open to monitor other scripts is somewhat of a burden.
- An example use case. If you have a loop, where if (var = "") is checked, but where var was never defined, that causes a #Warn error message every time, a custom function could record/report that error once only.
- (Also, external programs like DebugView have the disadvantage of receiving messages from multiple programs, not just AutoHotkey.)
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 15 guests