Sign in to follow this  
Followers 0
Wruck

Capturing Console Output (RTConsole.exe)

6 posts in this topic

I had had relative success in using RTConsole.exe to capture console output of various applications. I typically then take that output and port it over to a branded progress bar. However, I have noticed that RTConsole.exe is not flawless and crashes roughly 30-35% of the time. Overall point of this post is to see if anyone has any other suggestions to replace RTConsole.exe so I can kick RTConsole.exe to the curb

I have included a snippet of my code you all can see how I call it and perhaps provide some suggestions...

FileInstall("ImageX.exe", @TempDir & "\ImageX.exe")
FileInstall("RTConsole.exe", @TempDir & "\RTConsole.exe")

Func _ImageDevice($iDriveLetter)
Local $iCommand = @TempDir & "\ImageX.exe /apply " & @ScriptDir & "\MyImage.wim 1 " & $iDriveLetter & ":"
Local $iExecute = Run(@TempDir & "\RTConsole.exe " & $iCommand, @TempDir, @SW_HIDE, 6)
While 1
  $line = StdoutRead($iExecute)
  If StringInStr($line, 'ImageX Tool for Windows') <> 0 Then $line = "Loading Imaging Service"
  If StringInStr($line, 'Progress: 100%') <> 0 Then ExitLoop
  If StringInStr($line, 'Error') <> 0 Then ExitLoop
  If StringInStr($line, 'Successfully applied image.') <> 0 Then ExitLoop
  $line = StringStripWS($line, 7)
  $line3 = StringSplit($line, @CRLF)
  $line1 = StringSplit($line, '%')
  If StringRight($line1[1], 3) = 100 Then
   $line = 99
   $line3[1] = "Finalizing Image Application"
  Else
   $line = StringRight($line1[1], 2)
  EndIf
  If @error Then ExitLoop
  If $line <> "" Then
   ProgressSet($line, $line3[1])
  EndIf
WEnd
EndFunc   ;==>_ImageDevice

Share this post


Link to post
Share on other sites



I'm curious as to why you're using RTConsole when you're using the STDOUT channel to read from it, rather than just reading from the target program directly?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

ImageX.exe does a constant rewrite to STDOUT... was hoping to get a progressional progress output to pipe to a ProgressSet()

EDIT:

Now that I come back and re-read my post I realize I did not make a lot of sense. I followed that path as it was suggested

Edited by Wruck

Share this post


Link to post
Share on other sites

I'm trying to do the same thing as you, but with rar.exe, you find the way to do it?


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
happy.png

Share this post


Link to post
Share on other sites

The example code in my first post is working output through RTConsole.exe. I have yet to figure out a way to bypass using that application still...

Share this post


Link to post
Share on other sites

Try this UDF and see if it works for you -

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0