Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

shell-program and error handling

$
0
0

Hi! so..I understand that making a program without errors is better then just ignoring the errors and this is why i rarely use this method. However sometimes i need to test a program for longer periods of time without being able to check it so i've made this little shell-program:

AutoIt         
#include <Constants.au3> Global $n HotKeySet("{ESC}", "Terminate") $n = 0 While 1    If ProcessExists("iexplore.exe") Then ProcessClose("iexplore.exe") ;the program will open ie and i dont want to have too many opened at the same time    RunWait(@AutoItExe & ' /ErrorStdOut  "C:\Program Directory\Program Name.exe"')        $n = $n + 1     WEnd ;Terminate Func Terminate()    Local $ErrorLog = FileOpen("ErrorLog.txt",2)    FileWrite($ErrorLog, "The program crashed " & $n & " times")    FileClose($ErrorLog)    Exit 0 EndFunc

it gives me the number of times the program has crashed and was forced to restart on a txt file. I've tried to get on this txt file also the Error message by reading the stdout stream but i don't seem to be able to find a way to make it work. I've tried to use "run" instead of "runwait" in combination with "if processexists..." but it hasn't worked at all. If anyone could show me how to get the error message on a txt file it would be great! :D thanks in advance


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>