Sign in to follow this  
Followers 0
Hannes

GUICtrlCreateEdit Limit with 30000 strings

6 posts in this topic

Hello everyone,

i'm using Autoit 3.2.0.1 final.

Every Script i build is working fine and fast, and also very stable.

The most scripts are used to automate sms 2003, so i'm always want some return messages in a

GUICtrlCreateEdit Status field (within a gui).

At the moment i'm pushing hundreds of clients into a sms collection and the return codes etc. will be displayed in the control GUICtrlCreateEdit field ($edit_status).

The last scripts i wrote hadn't a bug like this one,

the control didn't add anything else, although the script worked on in the background without errors.

So i count the strings in the control, when it seems that the field would not be filled anymore.

After 30.000 Strings the GUICtrlCreateEdit field don't want anymore ...

GUICtrlSetData couldn't add somehting more strings into the control $edit_status,

is there an internal limit ?

[Autoit is MasterControlProgram (MCP)]

Thanks

Hannes

here is the (for next) routine that fills the gui:

(the functions funcGetResourceID and funcCreateDirectMemberShip have no errors)

For $x = 1 to $array_Computers[0]

If ($array_Computers[$x] <> "") Then ; And (StringInStr($array_Computers[$x], "CMHM", 0, 1) > 0)

$str_ResourceID = funcGetResourceID($array_Computers[$x])

If ($str_ResourceID <> "n/a") And ($str_CollectionID <> "") Then

If $x >= 267 Then MsgBox(0,"","Debug:" & @CRLF & StringLen(GUICtrlRead($edit_status)))

GUICtrlSetData($edit_status, "Anzahl: " & $x & "/" & $array_Computers[0] & @CRLF,1)

GUICtrlSetData($edit_status, "ResouceID gefunden: " & $str_ResourceID & @TAB & " [" & $array_Computers[$x] & "]" & @CRLF,1)

funcCreateDirectMemberShip($str_ResourceID,$str_CollectionID,$array_Computers[$x])

GUICtrlSetData($edit_status, "DirectRule für [" & $array_Computers[$x] & "] in Collection [" & $str_CollName & "] erzeugt." & @CRLF,1)

$counter = $counter + 1

GUICtrlSetData($edit_status, "------------------------------------------------------" & @CRLF,1)

Else

GUICtrlSetData($edit_status, "ResouceID NICHT gefunden: " & $str_ResourceID & @TAB & " [" & $array_Computers[$x] & "]" & @CRLF,1)

$error_counter = $error_counter + 1

GUICtrlSetData($edit_status, "------------------------------------------------------" & @CRLF,1)

EndIf

EndIf

Next

Share this post


Link to post
Share on other sites



I'm sure there is a 2147483646 chr limit. I have no idea if you've reached that.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Ok,

I wrote a simpe gui to check the prob again,

attached is a simple gui (press Hinzufügen) that generates 1000 lines in a edit field, try it.

With the Line

GUICtrlSetData($edit_status, "------------------------------------------------------" & @CRLF,1)

uncommented, you get only 30000 Strings read in the edit field (press Zurücksetzen) and only 424 from 1000 possible lines...

Wheres the error ?

Hannes

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Ok,

I wrote a simpe gui to check the prob again,

attached is a simple gui (press Hinzufügen) that generates 1000 lines in a edit field, try it.

With the Line

GUICtrlSetData($edit_status, "------------------------------------------------------" & @CRLF,1)

uncommented, you get only 30000 Strings read in the edit field (press Zurücksetzen) and only 424 from 1000 possible lines...

Wheres the error ?

Hannes

Yep, stops dead on 30,000 chars.

Edit:

Try this:

#include <String.au3>
#include <GUIConstants.au3>
#Include <date.au3>

; select * from Win32_NetworkAdapterConfiguration where IPEnabled=true and DHCPEnabled=true
; select * from Win32_IDEController where DeviceID like 'PCI\\VEN%'
; select * from Win32_PnPEntity where DeviceID like 'ROOT\\ACPI_HAL%'
; select cmd_Sequence,cmd_Test from Commands

Opt("RunErrorsFatal", 0)   ;1=fatal, 0=silent set @error
Opt("GUICoordMode",1)
Opt("GUIOnEventMode",1)
Opt("GUIResizeMode", 0)
Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced
Opt("MustDeclareVars",1)

Global $obj_Collection
Global $obj_SMS_WBEM, $obj_AdoSMS, $str_SMS_Server, $str_SMS_DB, $str_SMS_Site
Local $Server, $Name, $ID, $NameSpace
Global $com_error
Global $GUI0
Global $input_CollName,$input_SMSServer, $input_SMSNameSpace, $input_CollID
Global $button_ende, $button_add, $button_reset
Global $edit_status, $edit_computers
;-------------------------------------------------------------------------------------------------------------
$GUI0 = GuiCreate("Test",800,600,-1,-1,BitOR($WS_OVERLAPPEDWINDOW,$WS_CLIPSIBLINGS))
GUISetFont($GUI0,12,-1,"MS Sans Serif")
;-------------------------------------------------------------------------------------------------------------
GUISetOnEvent($GUI_EVENT_CLOSE, "funcWindowEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "funcWindowEvents")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "funcWindowEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "funcWindowEvents")
;-------------------------------------------------------------------------------------------------------------
GUICtrlCreateLabel("Collection Name:",10,10,200,25,-1,-1)
$input_CollName = GUICtrlCreateInput($Name,220,10,200,25,$ES_UPPERCASE,-1)
GUICtrlCreateLabel("SMS Server:",10,40,200,25,-1,-1)
$input_SMSServer = GUICtrlCreateInput($Server,220,40,200,25,$ES_UPPERCASE,-1)
GUICtrlCreateLabel("SMS Namespace:",10,70,200,25,-1,-1)
$input_SMSNameSpace = GUICtrlCreateInput($NameSpace,220,70,200,25,$ES_UPPERCASE,-1)
GUICtrlCreateLabel("Collection ID:",10,100,200,25,-1,-1)
$input_CollID = GUICtrlCreateInput($ID,220,100,200,25,$ES_UPPERCASE,-1)

$edit_computers = GUICtrlCreateEdit("",10,140,480,200,-1,-1)
$button_add     = GUICtrlCreateButton("Hinzufügen.",10,350,100,25,-1,-1)
GUICtrlSetOnEvent($button_add,"funcStart")
$button_reset   = GUICtrlCreateButton("Zurücksetzen.",150,350,100,25,-1,-1)
GUICtrlSetOnEvent($button_reset,"funcReset")
$button_ende    = GUICtrlCreateButton("Beenden.",290,350,100,25,-1,-1)
GUICtrlSetOnEvent($button_ende,"funcWindowEvents")

$edit_status    = GUICtrlCreateEdit("",10,390,780,200,BitOr($GUI_SS_DEFAULT_EDIT,$ES_READONLY, $ES_MULTILINE),-1)
GUICtrlSetLimit(-1,0x7FFFFFFF)
;-------------------------------------------------------------------------------------------------------------
GUICtrlSetState($input_CollName,$GUI_FOCUS)
GUISetState(@SW_SHOW)
;-------------------------------------------------------------------------------------------------------------
; Run the GUI until the dialog is closed
While 1
   Sleep(100)
Wend
;-------------------------------------------------------------------------------------------------------------
If IsObj($obj_AdoSMS) Then
    $obj_AdoSMS.Close
    $obj_AdoSMS = 0
    $obj_SMS_WBEM = 0
EndIf
Exit
; End of script
;///////////////////////////////////////////////////////////////////////////////
Func funcWindowEvents()

   Select

    Case @GUI_CTRLID = $GUI_EVENT_CLOSE AND @GUI_WINHANDLE = $GUI0
        GUIDelete($GUI0)
        Exit
    Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE
        ;MsgBox(0, "Window Minimized", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)
    Case @GUI_CTRLID = $GUI_EVENT_MAXIMIZE
    Case @GUI_CTRLID = $GUI_EVENT_RESTORE
    Case @GUI_CTRLID = $button_ende
        
        GUIDelete($GUI0)
        Exit
   
   EndSelect

EndFunc
;///////////////////////////////////////////////////////////////////////////////
Func funcReset()
    
    MsgBox(0,"","Debug:" & @CRLF & StringLen(GUICtrlRead($edit_status)))
    GUICtrlSetData($edit_computers, "")
    GUICtrlSetData($edit_status, "")
    
EndFunc
;///////////////////////////////////////////////////////////////////////////////
Func funcStart()
    
    Local $str_List, $str_ResourceID, $str_CollectionID, $array_Computers, $str_CollName
    Local $error_counter=0, $counter=0
    Local $timer_init, $timer_diff, $answer, $sum=50000
    
    $timer_init = TimerInit()
    
    $str_List           = StringUpper(GUICtrlRead($edit_computers))
    $str_CollectionID   = GUICtrlRead($input_CollID)
    $array_Computers    = StringSplit($str_List, @CRLF, 1)
    $str_CollName       = GUICtrlRead($input_CollName)
    

    For $x = 1 to $sum ; $array_Computers[0]
            GUICtrlSetData($edit_status, "Sum: " & $x & "/" & $sum & @CRLF,1)
            ToolTip(StringLen(GUICtrlRead($edit_status)))
;~          GUICtrlSetData($edit_status, "------------------------------------------------------" & @CRLF,1)
    Next
    ;--------------------------------------------------------------------------------------------
    $timer_diff = TimerDiff($timer_init)
    $timer_diff = Int($timer_diff/1000) & " Sekunden"
    ;--------------------------------------------------------------------------------------------
    GUICtrlSetData($edit_status, "------------------------------------------------------" & @CRLF,1)
    GUICtrlSetData($edit_status, "Erfolgreich hinzugefügte Clients: " & $counter & @CRLF,1)
    GUICtrlSetData($edit_status, "Nicht gefundene Clients: " & $error_counter & @CRLF,1)
    GUICtrlSetData($edit_status, "------------------------------------------------------" & @CRLF,1)
    GUICtrlSetData($edit_status, "Benötigte Zeit: " & $timer_diff & @CRLF,1)
    GUICtrlSetData($edit_status, "------------------------------------------------------" & @CRLF,1)
    GUICtrlSetData($edit_status, "Scriptende." & @CRLF,1)
    GUICtrlSetData($edit_status, "------------------------------------------------------" & @CRLF,1)
    
EndFunc
;///////////////////////////////////////////////////////////////////////////////
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Yeah thanks,

now that i added

GUICtrlSetLimit($edit_status,0x7FFFFFFF)

there's no limit anymore !

I keep this in mind, when using edit, list and othe gui controls.

Hannes

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