Sign in to follow this  
Followers 0
CodyBarrett

help with opening .ini data into a listview box

1 post in this topic

#1 ·  Posted (edited)

the title explains my sitution.. i guess this MIGHT be a double post if so i am sorry "see gui help for my SAVEING to ini post" now im having trouble loading from an ini into a listiewbox.... i got this code that i got some VERY usefull help in puting togther

;This is made by BOB
;(bob00037 on the autoitforums)
; This script Is An Information Organizer For The Not Very Widely Known MMORPG Endless Online;
#include <GuiConstantsEx.au3>
#Include <GuiListView.au3>
#include <ButtonConstants.au3>
#include <GuiConstants.au3>

DirCreate("C:\GUILDINFO")
If FileExists("C:\guildinfo\Guild.ini") Then
    
Else
    MsgBox(64,"no", "Does NOT exists")
    IniWrite("C:\GUILDINFO\Guild.ini", "Help", "#", "*****this is a help guide on the controlls of GI******                                                                                                                                                                                      #[For Each editbox hitting ENTER will call a function]                                            #[top right [X]=exit\OR\ ALT+f4=exit]                                                                         #[CANNOT edit the list box BUT just add a member then Delete it when you need to edit it, then ad again]                                                                                         #[DO NOT change the directory outputs (i have not designed it to be user friendly)]")
    IniWrite("C:\guildinfo\Guild.ini", "Personal", "#Text", "0")
    IniWrite("C:\guildinfo\Guild.ini", "CurrentMembers", "#Current", "0")
    iniwrite("C:\guildinfo\Guild.ini", "OldMembers", "#Old", "0")
    IniWrite("C:\guildinfo\Guild.ini", "Rules", "#Rule", "0")
    MsgBox(64,"NOW", "it exists")
    
    
EndIf
#region ; GLOBAL VARS
Global $GUI, $Pdt, $PSv, $Ldbtn, $Pdtdr, $INIp, $OpnDrb, $OpnDrI, $hlp, $INIh,$Delcm, $AdRcm, $Adrcm2, $Addcm, $listview, $Listview2, $INIcm, $Cmdt, $Cmld, $listedit, $CmSv, $Cmsv2, $CmLd, $CmLd2, $Cmcount, $Cmmemup, $CmMemCount, $Cmupdate
#EndRegion 

#region; GUI
$GUI = GuiCreate("GI    (Guild Information)   VERSION 0.00004", 400, 400)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)
#EndRegion


#Region ; PIC
GuiCtrlCreatePic("guild.bmp",0,0, 399,79)
#EndRegion


#Region ; Personal TAB
GuiCtrlCreateTab(0, 80)
GuiCtrlCreateTabItem("Personal")


_vars()
Func _vars()
    $PSv = GuiCtrlCreateButton("SAVE", 0, 360, 400, 20); The "save" button on the personal tab
    $OpnDrB = GuiCtrlCreateButton("OPEN DIR", 300, 315, 100, 20);  The "OPEN" button on the personal tab
    $Ldbtn = GUICtrlCreateButton("LOAD", 300, 335,100,20); The "load" button on the personal tab
    $hlp = GUICtrlCreateButton("HELP", 200, 380, 200,20); HELP button for the help file
    $Pdtdr = GUICtrlCreateInput("C:\guildinfo\guild.ini", 0, 335, 300, 20); The DIRECTORY input for LOAD on the personal tab
    $Pdt = GUICtrlCreateEdit(" ", 0, 130, 400, 175, 0x0004);The BIG input on the personal tab
    $OpnDrI = GUICtrlCreateInput("C:\guildinfo", 0, 315, 300, 20); The DIRECTORY input for OPEN DIR on the personal tab
    $INIp = IniRead("Guild.ini", "personal", "#text", ""); The [personal] .ini text readback call
    $INIh = IniRead("Guild.ini", "Help", "#", ""); The [help] .ini text readback call
EndFunc

; DATE
#Region
GuiCtrlCreateDate("", 0, 380, 200, 20)
#EndRegion
#EndRegion


#Region ;Guild TAB
GuiCtrlCreateTab(0, 80)
GuiCtrlCreateTabItem("Guild")

#Region ; DATE
GuiCtrlCreateDate("", 0, 380, 200, 20)
#EndRegion


#Region
 _vars2()
Func _vars2()
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)  ; to allow drag and dropping
    $CmMemCount = GUICtrlCreateEdit("0", 0, 130, 224, 20)
    $Adrcm = GuiCtrlCreateInput("Name|0|0|0|0", 0, 110, 224, 20)
    $Delcm = GuiCtrlCreateButton("Delete", 306, 110, 80, 20)
    $Addcm = GuiCtrlCreateButton("Add ", 226, 110, 80, 20)
    $listview = GuiCtrlCreateListView("Member|Rank|Warnings|Test Taken|Gone", 0, 150, 399, 200, BitOR($LVS_EDITLABELS, $LVS_EX_GRIDLINES))
    $Listview2 = GUICtrlRead($listview)
    $Adrcm2 = GUICtrlRead( $Adrcm )
    $CmSv = GUICtrlCreateButton("SAVE", 0, 360, 197, 18)
    $Cmsv2 = FileSaveDialog("SAVE", "C:\GUILDINFO\", "(*.ini*)", "guild.ini", "guild.ini")
    $Cmld = GUICtrlCreateButton("LOAD", 198, 360, 200, 18)
    $Cmupdate = GUICtrlCreateButton("UPDATE", 226,130,160,20)
    $CMmemup = IniRead("guild.ini", "CurrentMembers", "Itemcount", "default")
EndFunc
#EndRegion
#EndRegion

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $PSv
            MsgBox(0,"SAVE?",GUICtrlRead($Pdt))
            Iniwrite("guild.ini", "personal", "#text", GUICtrlRead($Pdt))
        Case $Ldbtn
            GUICtrlSetData ( $Pdt, $INIp )
        Case $OpnDrB
            MsgBox( 0, "OPEN?", "UDF Directory" )
        Case $hlp
            MsgBox(0,"Help?", "UDF file",GUICtrlRead($Pdtdr))
            GUICtrlSetData ( $Pdt, $INIh )
        Case $Addcm
            GUICtrlCreateListViewItem( GUICtrlRead( $Adrcm ), $listview)
        Case $Delcm
            _GUICtrlListView_DeleteItemsSelected($Listview)
        Case $CmSv
             if FileExists($cmsv2) then IniDelete($cmsv2,"CurrentMembers")
            IniWrite($cmsv2,"CurrentMembers","ItemCount",_GUICtrlListView_GetItemCount($listview))
            For $n = 0 To _GUICtrlListView_GetItemCount($listview) - 1
                $Itemtext = _GUICtrlListView_GetItemText($listview, $n)
                For $p = 1 To 5;for each column
                    $Itemtext &= '|' & _GUICtrlListView_GetItemText($listview, $n,$p)
                Next
                IniWrite($cmsv2,"CurrentMembers",$n,$Itemtext)
            Next
        Case $CmLd
            $NoItems = Number(IniRead($cmsv2,"listviewitems","ItemCount",""))
            For $n = 1 to $NoItems
            GUICtrlCreateListViewItem( (IniRead($cmsv2,"listviewitems", $n,""), $listview)
            next
        Case $Cmupdate
            GUICtrlSetData( $CmMemCount, $Cmmemup)
        EndSwitch
WEnd

that is the code for my entire GUI... any mistakes you guys can see?

Edited by bob00037

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