sayri80 Posted March 2, 2010 Posted March 2, 2010 Morning... I am trying to create a program that will dynamically create a treeview list pulling from lines in a text file but i am having trouble with the array part i think. Here is what i have so far, but it is not working. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <Date.au3> #include <GuiButton.au3> #include <File.au3> #include <Array.au3> ;======================================= ;======================================= ;Vars Global $storefile, $aArray[3] ;======================================= ;======================================= ;Gui $Gui = GUICreate("THD Zoom",800,600,-1,-1,-1) ; build main gui GUISetState(@SW_SHOW) ; set gui state to show $treearea = GUICtrlCreateTreeView(1,5,200,580) ; build treelist area ;======================================= ;======================================= While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case Else BuildList() EndSwitch WEnd Func BuildList() Dim $f = FileOpen(@ScriptDir & "\storelist.txt", 0) ; open file Dim $CountLines = _FileCountLines(@ScriptDir & $f) ; count number of lines Dim $CountLines = ($CountLines + 1) ; add 1 to the number of lines in the file Dim $store; declare the array ;Dim $i = 1 For $i = 1 To $CountLines Step 1 ; for each line in the file, do the following: $store[$i] = FileReadLine($f, $i) ; read each line in the file If @error = -1 Then ExitLoop $store[$i] = GUICtrlCreateTreeViewItem($store[$i],$treearea) ; create tree GUICtrlCreateTreeViewItem("ISP", $store[$i]) ; add isp to tree GUICtrlCreateTreeViewItem("PSP", $store[$i]) ; add psp to tree GUICtrlCreateTreeViewItem("SWP", $store[$i]) ; add swp to tree Next FileClose($f) EndFunc
water Posted March 2, 2010 Posted March 2, 2010 This example was very helpful for me. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now