Jump to content

Stdout Output in GUI Stalls Out Due to Number of Entries


Recommended Posts

Hello.  I am calling the Dell Command Update command line utility and it processes the console output into the GUI just fine.  When using a LAN connection, due to faster download speeds all of the console output gets displayed in the GUI without a problem.  However, with a WLAN connection, since it is not as fast, there are more output results logged during the download results so it doesn't output all of the results in the GUI.

Example output that shows up in the GUI is the following....

Downloading updates (4 of 8), 263.6 MB of 599.6 MB transferred (44.03%)...

Is there a way in the code below to have a bigger "buffer" per se, so all results get logged within the GUI from the console output?  This occurs about after 367 lines of the above output mentioned in bold. 

As far as the "progra~2" in the path, the executable was doing flakey if I recall specific to Dell Command Update, so I didn't use the variable in that case, but that's neither here or there. 🙂  Thanks.

#NoTrayIcon
#RequireAdmin


#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <StaticConstants.au3>


If ProcessExists("dcu-cli.exe") Then
    ProcessWaitClose("dcu-cli.exe")
EndIf

$Gui  = GUICreate("Dell Command Updater", 806, 598,-1,-1,"",$WS_EX_TOPMOST)
$Edit = GUICtrlCreateEdit("", 10,10,780,550, $ES_AUTOVSCROLL + $WS_VSCROLL + $ws_hscroll + $es_readonly)
GUICtrlSetFont(-1,8.5,800,default,'courier new')


GUISetState(@SW_SHOW)

Global $rslt,$out
                $rslt = Run(@comspec & " /c " & "c:\Progra~2\Dell\CommandUpdate\dcu-cli.exe" & " /applyUpdates -outputLog=C:\Temp\DellCommandUpdater.log", @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD)
                Sleep(5000)

                While 1
                    Sleep(1000)
                    $out = StdoutRead($rslt)
                    If @error then exitloop
                    GUICtrlSetData($edit,$out & @lf,1)
                WEnd

 

Link to comment
Share on other sites

3 hours ago, TheCrimsonCrusader said:

However, with a WLAN connection, since it is not as fast, there are more output results logged during the download results so it doesn't output all of the results in the GUI.

Possibly the text limit of the edit control is too small and needs to be increased.
Example :

#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>

_Example()

Func _Example()
    Local $idEdit, $sRead , $sFilename

    ; Example : Read GDIPlus.au3 and show the code in an Edit control :
    $sFilename = StringRegExpReplace(@AutoItExe, "(?i)AutoIt3.exe$", "") & "Include\GDIPlus.au3"
    $sRead     = FileRead($sFilename)

    GUICreate("Test : Huge Edit Control", 1200, 600)
    $idEdit = GUICtrlCreateEdit("", 2, 2, 1194, 568)

    ; Gets the current text limit for an edit control :
    MsgBox(BitOR(4096, 64), "Info :", "Limit : Edit Control (Chars) = " & _GUICtrlEdit_GetLimitText($idEdit) & @CRLF)

    ; Sets a new text limit :
    _GUICtrlEdit_SetLimitText($idEdit, 1500000)
    MsgBox(BitOR(4096, 64), "Info :", "New Limit : Edit Control (Chars) = " & _GUICtrlEdit_GetLimitText($idEdit) & @CRLF)

    GUISetState(@SW_SHOW)
    _GUICtrlEdit_AppendText($idEdit, $sRead)
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Example

(It could also be due to the buffer size of the CMD console)

Maybe a stupid question, but couldn't you use the file -outputLog=C:\Temp\DellCommandUpdater.log  straight away?

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...