Kyan Posted February 7, 2012 Posted February 7, 2012 (edited) Hi everyone I don't know much about programming and this kind of stuff, I really started work with autoit a few days ago, so don't blame me about if it was in FAQ or elsewhere :s How can I get the progress status from rar.exe? in variable "$message" I'll have the ouput from rar.exe, the only code I need is xx% from prompt, how can I "convert" this to a variable and refresh every time, to set in a progress bar? #include <Constants.au3> $foo = Run(@ProgramFilesDir & 'winrarrar.exe', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StdoutRead($foo) If @error Then ExitLoop $message = "" $message = $message & $line & @LF Wend thanks in advance, and sorry for my bad english. props from Portugal Edited February 7, 2012 by DiOgO Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
water Posted February 7, 2012 Posted February 7, 2012 Hi and welcome to AutoIt and the forum!You have chosen an easy task to start with I haven't tried it myself but maybe this can help you a bit. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
wraithdu Posted February 7, 2012 Posted February 7, 2012 In my experience trying to grab progress output from wget... it's a royal PITA. You've got the basic framework for it. You'll need to parse the output in $line using whatever works (StringInStr or StringRegExp) on each loop, determine what info is useful, or wait to grab more output from the next loop. Once you find useful output, do something with it and clear your output buffer ($line). Best place to start would be to capture ALL the output from an operation and print it to a file so you know the output content you're working with.
wraithdu Posted February 7, 2012 Posted February 7, 2012 You have chosen an easy task to start withHate to say I disagree. Parsing real-time progress output from command line applications, especially ones that use fancy progress output (ie wget), is NOT easy.
water Posted February 7, 2012 Posted February 7, 2012 Hi wraithdu, it wasn't meant the way you understand it. See the smiley? I wanted to say that he has chosen a quite complex task to start with. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Kyan Posted February 7, 2012 Author Posted February 7, 2012 In my experience trying to grab progress output from wget... it's a royal PITA. You've got the basic framework for it. You'll need to parse the output in $line using whatever works (StringInStr or StringRegExp) on each loop, determine what info is useful, or wait to grab more output from the next loop. Once you find useful output, do something with it and clear your output buffer ($line).Best place to start would be to capture ALL the output from an operation and print it to a file so you know the output content you're working with.could you give a example? (if I don't are asking to much )Hate to say I disagree. Parsing real-time progress output from command line applications, especially ones that use fancy progress output (ie wget), is NOT easy.I think he's being sarcastic Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
wraithdu Posted February 7, 2012 Posted February 7, 2012 Hi wraithdu, it wasn't meant the way you understand it. See the smiley? I wanted to say that he has chosen a quite complex task to start with. Apparently my internet sarcasm meter is broken today. @DiOgO Post some sample output that you capture from a full rar.exe run, and someone might be able to give you a pointer. It would be even more useful if you can mark in the output where each capture loop begins and ends. For example: #include <Constants.au3> $foo = Run(@ProgramFilesDir & 'winrarrar.exe', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Global $err1 = 0, $err2 = 0 While 1 $line = StdoutRead($foo) If @error Then $err1 = 1 If $line Then ConsoleWrite("|stdout|" & $line & "||" & @CRLF) $line = StderrRead($foo) If @error Then $err2 = 1 If $line Then ConsoleWrite("|stderr|" & $line & "||" & @CRLF) If $err1 And $err2 Then ExitLoop Wend
Kyan Posted February 7, 2012 Author Posted February 7, 2012 Apparently my internet sarcasm meter is broken today. @DiOgO Post some sample output that you capture from a full rar.exe run, and someone might be able to give you a pointer. It would be even more useful if you can mark in the output where each capture loop begins and ends. For example: #include <Constants.au3> $foo = Run(@ProgramFilesDir & 'winrarrar.exe', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Global $err1 = 0, $err2 = 0 While 1 $line = StdoutRead($foo) If @error Then $err1 = 1 If $line Then ConsoleWrite("|stdout|" & $line & "||" & @CRLF) $line = StderrRead($foo) If @error Then $err2 = 1 If $line Then ConsoleWrite("|stderr|" & $line & "||" & @CRLF) If $err1 And $err2 Then ExitLoop Wend output from autoit with writefile...: http://www13.zippyshare.com/v/35557891/file.html could you explain what is |stdout|? and what it does: If $line Then ConsoleWrite("|stdout|" & $line & "||" & @CRLF) $line = StderrRead($foo) thanks Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
wraithdu Posted February 7, 2012 Posted February 7, 2012 (edited) Umm, it's just a string, nothing more. I was using it to mark where each line of output starts/ends. I don't see those markers in your output file. Either way, the output is pretty simple. Just use a regular expression to grab the percentages. Edited February 7, 2012 by wraithdu
Kyan Posted February 7, 2012 Author Posted February 7, 2012 Hi and welcome to AutoIt and the forum! You have chosen an easy task to start with I haven't tried it myself but maybe this can help you a bit. thanks could you explain this part: _StringStripNotNumber($ReadRarLine) ?? in this part RunRarButton displays abort, right? thats why it close rar process? If $Msg = $RunRarButton Then ProcessClose($ReadRar) GUICtrlSetData($Progress, 0) EndIf and I don't understand nothing of this line: ^ *([0-9]+.{0,1}[0-9]*|0x[0-9]+) *$ Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Kyan Posted February 7, 2012 Author Posted February 7, 2012 Umm, it's just a string, nothing more. I was using it to mark where each line of output starts/ends. I don't see those markers in your output file. Either way, the output is pretty simple. Just use a regular expression to grab the percentages.regular expression? in the output appears some strange characters, I think is from rar.exe upgrading the percentage value withou creating a new line... Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
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