Using The _LINE_NUM Variable To .txt file

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
MadQuestion
Pro Scripter
Posts: 70
Joined: Wed Nov 08, 2017 6:54 pm

Using The _LINE_NUM Variable To .txt file

Post by MadQuestion » Mon Nov 13, 2017 9:21 pm

Is it possible to log the variable _LINE_NUM to a text file on the event that the _LINE_NUM variable has not changed in a certain period of time? Any tips or suggestions are welcome as this would greatly help me debug errors when the script runs into a dead end point without using the debugger. I would like to log the script line that the script has run into a dead end at into a .txt file so that I can better locate the dead ends in my script.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Using The _LINE_NUM Variable To .txt file

Post by Marcus Tettmar » Tue Nov 14, 2017 7:46 am

No but you can dump all variables to the log file with _DUMP_VARS and then analyse the log file. But ... not sure this makes sense ... if line number stops changing then nothing else could possibly be happening either, so your issue will always be right at the end of the log file showing the last thing that happened. So really all you need to do is look at the end of the log file.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

MadQuestion
Pro Scripter
Posts: 70
Joined: Wed Nov 08, 2017 6:54 pm

Re: Using The _LINE_NUM Variable To .txt file

Post by MadQuestion » Tue Nov 14, 2017 10:15 am

Will the log still get logged with a compiled exe?

MadQuestion
Pro Scripter
Posts: 70
Joined: Wed Nov 08, 2017 6:54 pm

Re: Using The _LINE_NUM Variable To .txt file

Post by MadQuestion » Tue Nov 14, 2017 10:29 am

Basically when a non modal dialog is open for too long with no user interaction or input I want to log the wait as an error into the top line of a txt file but only after a lengthy period of time has passed. How would this be achieved?

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Using The _LINE_NUM Variable To .txt file

Post by Marcus Tettmar » Tue Nov 14, 2017 1:23 pm

Not sure how you could. If it's modal the script can't do anything while it's open. But if you create a second macro and compile it to an .exe that could WaitWindowOpen the dialog and then loop until it's closed, measuring elapsed time as it goes. Stop looping when elapsed time reaches your desired timeout, and record to log file, or stop looping and start again if closed.

OR, don't use a modal dialog, use a non-modal dialog and have your macro loop once it's opened, waiting for it to either be closed or the timeout expires. Effectively this replicates how a modal dialog works - a loop holds things up until it's closed, but with the addition of a timeout check within the loop.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

MadQuestion
Pro Scripter
Posts: 70
Joined: Wed Nov 08, 2017 6:54 pm

Re: Using The _LINE_NUM Variable To .txt file

Post by MadQuestion » Tue Nov 14, 2017 5:51 pm

This is a great idea, thanks I will check it out. Compiling another exe may be a viable option at this point. Thanks Marcus :)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts