andyswarbs Posted February 11, 2006 Share Posted February 11, 2006 (edited) PopG_Run.au3 #region Doc: #region Doc: Notes ; Extends functionality for running external programs. ; ; RunErrorsFatal needed to avoid Au3 collapse! #endregion Doc: Notes #region Doc: Requirements ; Requires Au3 build 3.1.1.109 or better. ; Also uses include libraries array and constants. #endregion Doc: Requirements #region Doc: FunctionList ; _RunWaitOutErr Runs a (dos) command until completion, returning output & error lines into two arrays ; _RunWaitSys Does a RunWait for a command in the system folder ; _RunWaitSysOutErr Does a RunWaitOutErr in Sys folder #endregion Doc: FunctionList #region Doc: History ; 20-Feb-06 Als Updated _RunWaitOutErr Debugged further proceessing to ensure line breaks are processed properly. ; 19-Feb-06 Als _RunWaitOutErr updated to separate out data collection from parsing into arrays. ; 13-Feb-06 Als Commented out RegExpReplace on request of two Au3 users. #endregion Doc: History #endregion Doc: Edited February 19, 2006 by andyswarbs Licensing.au3Extended _Max & _Min_MsgBoxExitVarious extensions to _GuiCtrl...Run Dos programs output into an array etc (Updated 19-Feb-06)Extensions to Array library, primarily in two dimensions (updated 20-Feb-06)Version dependency calculator, _IsVer1GEVer2User Management, answering some domain questions (updated 19-Feb-06, various bugfixes and new functions added)Extensions to registry manipulation, including a recursive search & replaceDelimited string library (updated 19-Feb-03, added _DelimListSort)String library extensionsTerminal Server supportFile libraryCommand line parser (added 18-Feb-06)(UDF homepage) (Scit4Au3 UserCallTips added 21-Feb-06) Link to comment Share on other sites More sharing options...
mikeytown2 Posted February 11, 2006 Share Posted February 11, 2006 I know some people have been asking for something like this _RunWaitOutErr for some time. If it does what you say it does which is returning output & error lines into two arrays. That will be huge if you can read the output from a cmd prompt. I havent tested these out yet but if it does what it says then, dude cool program. Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack Link to comment Share on other sites More sharing options...
andyswarbs Posted February 11, 2006 Author Share Posted February 11, 2006 (edited) It indeed does do what it says "on the box". I would appreciate someone helping debug the code regarding StringLen. If StringLen($TmpVal)>1 Then _ArrayAdd($rwoeOutArr,$TmpVal);should be >0 but some bug there! **************************** What the hell is going on there is a mystery to me. I tried to see if there were any control chars, and there weren't. So I do not know, and that's the truth. Edited February 11, 2006 by andyswarbs Licensing.au3Extended _Max & _Min_MsgBoxExitVarious extensions to _GuiCtrl...Run Dos programs output into an array etc (Updated 19-Feb-06)Extensions to Array library, primarily in two dimensions (updated 20-Feb-06)Version dependency calculator, _IsVer1GEVer2User Management, answering some domain questions (updated 19-Feb-06, various bugfixes and new functions added)Extensions to registry manipulation, including a recursive search & replaceDelimited string library (updated 19-Feb-03, added _DelimListSort)String library extensionsTerminal Server supportFile libraryCommand line parser (added 18-Feb-06)(UDF homepage) (Scit4Au3 UserCallTips added 21-Feb-06) Link to comment Share on other sites More sharing options...
DaveF Posted February 12, 2006 Share Posted February 12, 2006 (edited) Is a CR/LF a character? A "blank line" of output is a single character, the "return" at the end...Too much wine, let me try again: you're splitting the read data on LF characters, which leaves the CR character in the "empty line" strings, so you get a StringLen of 1 on those lines.I had sent you a PM earlier,$TmpVal=StringRegExpReplace($TmpArr[$TmpIdx],'^:\A', '')doesn't do what I think you want it to, it just eats the first two characters from a line if it starts with a colon and an alphanumeric character. I'm guessing that you intend it to supress "blank" (whitespace only) lines? You might provide that as an option to the function, but I wouldn't do it as the default; provide the user with the simple functionality and let them sort out the details...[Edit: Clarification. Don't drink and post.] Edited February 12, 2006 by DaveF Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
andyswarbs Posted February 12, 2006 Author Share Posted February 12, 2006 Yep, I was trying to get rid of whatever was causing that glitch, and probably the answer I came up with is not correct. Time for another play. But it still does not solve the core problem of why the stringlen>0 does not work and why stringlen>1 does. At the time I felt that it was a bug in Au3, but it could be my ignorance elsewhere. Licensing.au3Extended _Max & _Min_MsgBoxExitVarious extensions to _GuiCtrl...Run Dos programs output into an array etc (Updated 19-Feb-06)Extensions to Array library, primarily in two dimensions (updated 20-Feb-06)Version dependency calculator, _IsVer1GEVer2User Management, answering some domain questions (updated 19-Feb-06, various bugfixes and new functions added)Extensions to registry manipulation, including a recursive search & replaceDelimited string library (updated 19-Feb-03, added _DelimListSort)String library extensionsTerminal Server supportFile libraryCommand line parser (added 18-Feb-06)(UDF homepage) (Scit4Au3 UserCallTips added 21-Feb-06) Link to comment Share on other sites More sharing options...
DaveF Posted February 13, 2006 Share Posted February 13, 2006 Have a look at this, if you would: Dim $ourProcess, $ourOutput $ourProcess = Run(@ScriptDir & "\blankline.exe", @ScriptDir, @SW_HIDE, 2) ;# Blankline.exe writes the output: ;Blank line follows... ; ;The End. ;# Read the output While 1 $ourOutput &= StdoutRead($ourProcess) If @error = -1 Then ExitLoop WEnd ; Split on linefeed $ourOutput = StringSplit($ourOutput, @LF) ; Step over resulting array For $step = 1 To $ourOutput[0] If $step = 2 Then If StringLen($ourOutput[$step]) > 0 Then MsgBox(0, "Debug", 'The first character has of the "blank" line has ASCII code: ' & Asc(StringLeft($ourOutput[$step], 1))) Else MsgBox(0, "Debug", "The blank line had zero length.") EndIf EndIf Next blankline.exe (place in the same folder and compile before running): ConsoleWrite("Blank line follows..." & @CRLF & @CRLF & "The End.") Microsoft newlines are CR/LF pairs, splitting on LF only leaves behind the CR (ASCII code 13) on a "blank" line... Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
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