Jump to content

_GUICtrlEdit_AppendText


Recommended Posts

Hi,

I have the following portion of code.

For $j = 2 To $out[0]
    $test = (GUICtrlRead($Input1) & ' ' & $Enc & ' ' & '"' & $out[1] & '\' & $out[$j] & '"' & ' /pfx ' & GUICtrlRead($Input3) & ' ' & '********' & ' /cer ' & GUICtrlRead($Input5) & $Verbose)
    _GUICtrlEdit_AppendText($EditStdOut, @CRLF & $test)
    Sleep(1000)
    $hRunStream = Run(GUICtrlRead($Input1) & ' ' & $Enc & ' ' & '"' & $out[1] & '\' & $out[$j] & '"' & ' /pfx ' & GUICtrlRead($Input3) & ' ' & GUICtrlRead($Input4) & ' /cer ' & GUICtrlRead($Input5) & $Verbose, '', @SW_HIDE, $STDOUT_CHILD)
    While 1
        $sStreamOut = StdoutRead($hRunStream)
        If @error Then
            ExitLoop
        Else
            _GUICtrlEdit_AppendText($EditStdOut, @CRLF & $sStreamOut)
        EndIf
        Sleep(100)
    WEnd
Next

The issue I have is this, Let's say I have 27 files to process. The script processes 25 of those and updates the GUICtrlCreateEdit box successfully. But after the 25th file, though the subsequent files get processed successfully, the GUICtrlCreateEdit box does not get updated.

What am I missing here? Please advise.

Thank you.

mouse not found....scroll any mouse to continue.

Link to comment
Share on other sites

You might have reached the limit of the edit control, depending on how large the files are. Use _GUICtrlEdit_SetLimitText to increase the limit to how many characters can be stored in the edit.

I've used

_GUICtrlEdit_SetLimitText($idEdit, 2 ^ 32 - 1)

for edit boxes I used as a debug window. (2^32 for the 32bit OS and -1 to account for the 0)

Edited by InunoTaishou
Link to comment
Share on other sites

@InunoTaishou: i never reached a limit of a Editcontrol created with _GUICtrlEdit_Create. Here a small script (orihinal is a productive script):

;#include <Array.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
#include <EditConstants.au3>

    Global $sAutoItPath=StringReplace(StringReplace(@AutoItExe,'_64',''),'autoit3.exe','')
    ConsoleWrite(@AutoItExe&@CRLF)
    Global $aAu3Files=_FileListToArray($sAutoItPath&'Examples\Helpfile','*.au3',$FLTA_FILES, True)
;   _ArrayDisplay($aAu3Files)
    Global $hLog, $idlblLines, $bCancel, $idPrgFile

_CreateGui()

Func _CreateGui()
    Local $hMainGui = GUICreate("Example _GUICtrlEdit_AppendText", 650, 400, 271, 235)
    $hLog =     ($hMainGui,'',8, 5, 467, 314, BitOR($WS_HSCROLL, $WS_VSCROLL,  $ES_MULTILINE, $ES_WANTRETURN, $ES_READONLY))
    $idPrgFile = GUICtrlCreateProgress(8, 344, 598, 25)
    $idlblLines = GUICtrlCreateLabel('', 8, 375, 598, 25)
    Local $idBtnStart = GUICtrlCreateButton("&Start", 483, 120)
    Local $idBtnExit = GUICtrlCreateButton("&Exit", 483, 293)
    ;_GUICtrlEdit_SetLimitText($hLog 2 ^ 32 - 1)    ;i never reached a limit
    GUISetState(@SW_SHOW, $hMainGui)
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $Gui_EVENT_CLOSE, $idBtnExit
                Exit
            Case $idBtnStart
                GUICtrlSetState($idBtnExit, $Gui_DISABLE)
                GUICtrlSetState($idBtnStart, $Gui_DISABLE)
                HotKeySet("{Esc}","_captureEsc")
                _ShowAu3Files()
                HotKeySet("{Esc}")
                GUICtrlSetState($idBtnStart, $Gui_ENABLE)
                GUICtrlSetState($idBtnExit, $Gui_ENABLE)
        EndSwitch
    WEnd
EndFunc   ;==>_CreateGui

Func _ShowAu3Files()
    Local $aFile, $iLines
    For $i=1 To $aAu3Files[0]
        _report('########################################################',$hLog)
        _report($aAu3Files[$i],$hLog)
        $iLines+=2
        _FileReadToArray($aAu3Files[$i],$aFile)
        For $j=1 To $aFile[0]
            If $bCancel Then $bCancel=_RealyCancel($hLog)
            If $bCancel Then
                _report('User aborted demo',$hLog)
                $iLines+=1
                ExitLoop 2
                GUICtrlSetData($idlblLines,$iLines)
            EndIf
            $iLines+=1
            _report($aFile[$j],$hLog)
        Next
        _report('### EOF '& $aAu3Files[$i]&'###',$hLog)
        $iLines+=1
        GUICtrlSetData($idPrgFile,$i*100/$aAu3Files[0])
        GUICtrlSetData($idlblLines,$iLines)
    Next
EndFunc

Func _report($sMsg, $hLog = 0, $hFileLog = 0)
    ;===============================================================================
    ; Autor(s):         AutoBert (www.autoit.de)
    ; modified:         durch/Grund hier anfügen
    ;===============================================================================
    If $hLog <> 0 Then _GUICtrlEdit_AppendText($hLog, $sMsg & @CRLF)
    If $hFileLog > 0 Then _FileWriteLog($hFileLog, $sMsg & @CRLF)
EndFunc   ;==>_report

Func _captureEsc()
    $bCancel = True ;$bCancel ist in FTP_FileList_Recursiv.au3 Global definiert,
                    ;wenn True wird die  Aktion nach Userbestätigung abgebrochen
EndFunc

Func _RealyCancel($hLog = 0, $hParent = 0)
    ;===============================================================================
    ; Autor(s):         AutoBert (www.autoit.de)
    ;                   zur freien Benutzung in eigenen Skripten/EXE'n
    ;                   und auch zur freien Weitergabe unter der Vorgabe,
    ;                   daß diese Funktionsbeschreibung inkl. Autor nicht enfernt wird.
    ;                   Bei EXE'n wäre es nett mich zu erwähnen, ist aber keine Pflicht.
    ; modified:         durch/Grund hier anfügen
    ;===============================================================================
    If MsgBox($MB_YESNO + $MB_ICONQUESTION + $MB_DEFBUTTON2 + $MB_APPLMODAL, 'Download abbrechen', 'Wollen Sie wirklich abbrechen?', 0, $hParent) = $IDYES Then
        _report('Abbruch durch Benutzer', $hLog, 1)
        $bCancel = True
    Else
        $bCancel = False
    EndIf
    Return $bCancel
EndFunc   ;==>_RealyCancel

to cancel Output press once ESC and after confirm abort in MsgBox.

Edited by AutoBert
c&p failure elimninated
Link to comment
Share on other sites

Hi InunoTaishou, 

thanks for pointing out this function. i will try this out.

 

Hi AutoBert, 

Line 19 : $hLog = ($hMainGui,

error: unbalanced paranthesis expression.
error: syntax error
 

mouse not found....scroll any mouse to continue.

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