Sign in to follow this  
Followers 0
FreeFry

AutoIt Limit resolution

3 posts in this topic

Hi all.

I have a problem relating to AutoIt's limit of how many controls you can have in one gui.

I've made this gui from which you can load Items from a file of your choice, which contains list of items(items get loaded into the gui and gets a control id), and if one file holds over 8000 items, the load exceeds the autoit limit, and then you cant see the rest of the items.

I wonder if anyone have a good idea of how to solve this, because i want it to look clean, but does it really require me to create a new gui window? :)

Share this post


Link to post
Share on other sites



because they are added to the GUI... they should not need a control id

it would be much better to use a variable name with or without an array

Autoit limits

Arrays: A maximum of 64 dimensions and/or a total of 16 million elements

Maximum number of variables in use at one time: No limit

Maximum number of user defined functions: No limit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi, well i think i need to have a controlID, because i use GuiCtrlCreateTreeView, then i add all items to that list with GUICtrlCreateTreeViewItem, and they all have a checkbox so that you can click in the items that you want, then press a button to get the item data that is read from the file, and use that data in a game.. so i need to have a tree view i think =/

this is my code:

#include <GuiConstants.au3>

Opt("WinTitleMatchMode", 4)
Opt("SendKeyDelay", 35)
Opt("SendAttachMode", 1)

Global $data, $ItemCount = 0, $ItemArray[1][4]
Func _loadItems()
    
    $file = FileOpenDialog("Select the item file to open", "", "Item Files (*.scp)", 1)
    
    $FileHandle = FileOpen($File, 0)
    
    While 1
        $line = FileReadLine($FileHandle)
        If @error = -1 Or @error Then
            ExitLoop
        ElseIf StringLeft($line, 1) = "[" Then
            $ItemCount += 1
            ReDim $ItemArray[$ItemCount][4]
            $ItemArray[$ItemCount-1][0] = StringTrimRight(StringTrimLeft($line, 6), 1)          ;ID of the item
            $line = FileReadLine($FileHandle)
            $ItemArray[$ItemCount-1][1] = "#" & $ItemCount-1 & " " & StringTrimLeft($line, StringInStr($line, "="));Name of the item
            $ItemArray[$ItemCount-1][2] = GUICtrlCreateTreeViewItem($ItemArray[$ItemCount-1][1], $Treeview_2);Ctrl ID of the item (gui related)
            GUICtrlSetData($Label_1, "Item Count: " & $ItemCount)
        EndIf
    WEnd
    
    FileClose($FileHandle)
    
EndFunc

Func _additem()
    Local $oldClip = ClipGet()
    WinActivate("classname=GxWindowClassD3d")
    WinWaitActive("classname=GxWindowClassD3d")
    For $i = 0 To $ItemCount-1
        If $ItemArray[$i][3] = 1 Then
            $ItemArray[$i][3] = 0
            GUICtrlSetState($i+7, $GUI_UNCHECKED)
            GUICtrlSetData($i+7, $ItemArray[$i][1] & " -Added-")
            ClipPut(".add " & $ItemArray[$i][0])
            Send("{enter}^v{enter}")
        EndIf
    Next
    ClipPut($oldClip)
EndFunc

;~ Func _removeitem()
;~  Local $oldClip = ClipGet()
;~  WinActivate("classname=")
;~  WinWaitActive("classname=")
;~  For $i = 0 To $ItemCount-1
;~      If $ItemArray[$i][3] = "" Then
;~          ClipPut(".add " & $ItemArray[$i][0])
;~          Send("{enter}^v{enter}")
;~      EndIf
;~  Next
;~  ClipPut($oldClip)
;~ EndFunc

GuiCreate("Item Manager", 386, 609,(@DesktopWidth-386)/2, (@DesktopHeight-709)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Group_1 = GuiCtrlCreateGroup("Items", 20, 10, 350, 530)
$Treeview_2 = GuiCtrlCreateTreeview(30, 30, 330, 500, $TVS_CHECKBOXES + $TVS_SHOWSELALWAYS + $TVS_DISABLEDRAGDROP)
$Button_4 = GuiCtrlCreateButton("Load Item List", 10, 560, 80, 20)
$Button_5 = GuiCtrlCreateButton("Add Item(s)", 100, 560, 60, 20)
$Label_1 = GUICtrlCreateLabel("Item Count: " & $ItemCount, 170, 560, 100)
;$Button_6 = GuiCtrlCreateButton("Remove Item(s)", 170, 560, 80, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    $selected = GUICtrlRead($Treeview_2)
    If GUICtrlRead($selected) = 257 Then
        $ItemArray[$selected-7][3] = 1      ;$ItemArray[$][3] = Checkbox Status
    EndIf
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_4
            _loadItems()
            MsgBox(0, "Done!", "Loading of items is done!")
        Case $msg = $Button_5
            _additem()
    EndSelect
WEnd
Edited by FreeFry

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