ShadoWarrior Posted December 26, 2009 Posted December 26, 2009 (edited) I've built a script that runs on the background of my computer.... and it needs to run for hours so i can't track it manually all the time and their are always bug to be fixed... i want to write a script that monitor the first one and log it's runtime errors with details. thought of using "StderrRead" but i don't quite understand how to use it... #include <Constants.au3> Global $FileName = IniRead("Setting.ini", "Monitors", "Machine", "NotFound") & "/ErrorStdOut" ; "first" auto-it script already compiled Global $Location = IniRead("Setting.ini", "Monitors", "Location", "NotFound") Local $foo = Run($FileName ,$Location,@SW_HIDE,$STDERR_CHILD) Local $line While 1 $line = StderrRead($foo) If @error Then MsgBox(0, "STDERR read:", $line) ExitLoop EndIf Sleep(1000) Wend MsgBox(0, "Debug", "Exiting...") tried to use this simple script but $line just return blank after a runtime error... Edited December 26, 2009 by ShadoWarrior
ShadoWarrior Posted January 4, 2010 Author Posted January 4, 2010 I'm lost... I just need a way to log the script runtime errors into a log file... any help will be appreciated.
James Posted January 4, 2010 Posted January 4, 2010 thought of using "StderrRead" but i don't quite understand how to use it...That will only work if you're writing to the STDOut in the first place, StdinWrite().I'm lost... I just need a way to log the script runtime errors into a log file...any help will be appreciated.What kind of errors are we talking about here? Are you dealing with COM, Arrays with incorrect subscript dimensions? What? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
JohnOne Posted January 4, 2010 Posted January 4, 2010 (edited) Perhaps you could do something crude such as adding throughout your code If @error then _errorlog(@error) ExitLoop And having a function #include <file.au3> Func _errorlog($error) _FileWriteLog(@ScriptDir, $error, -1) ;Some other code EndFunc Edited January 4, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
ShadoWarrior Posted January 6, 2010 Author Posted January 6, 2010 most of the error i get are related to arrays. what i need is to see where the error occurred in the original script so i can fix it... but the script work in a compiled form, so any info regarding the source of the problem dissipates into a general error box...something like error in line -1. I'm looking for a way to log all the errors that makes the script stop.
ShadoWarrior Posted January 6, 2010 Author Posted January 6, 2010 Perhaps you could do something crude such as adding throughout your code [ code='text' ] ( Popup ) If @error then _errorlog(@error) ExitLoop And having a function [ code='text' ] ( Popup ) #include <file.au3> Func _errorlog($error) _FileWriteLog(@ScriptDir, $error, -1) ;Some other code EndFunc it's a very good idea JohnOne but the script is very very long and bugs can have many forms and be anywhere... i just what to be able to see the error info as i would if the script wasn't compiled
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now