Jump to content

Putting Info From .ini File Into Listview


Chobby
 Share

Recommended Posts

Hey guys ...

I really cant figure out if this is even possible..

I am trying to write a little gui where i can read and write IP's and information about the IP into a .ini file..

The .ini is just to store the data..

Thats my first problem really..

I've just created a little fast script.. Take a look, and tell me how i could get info from .ini files into the list, please :think:

Thanks on prehand..

#include <GUIConstants.au3>

GUICreate("IP Program - By Chobby")
GUISetState(@SW_SHOW)
Opt("TrayIconHide", 1)  

;List
$listView = GuiCtrlCreateListView("IP|Country|Name|Clan|", 10, 10, 380, 350)
;Items
$item1 = GuiCtrlCreateListViewItem("0.0.0.0|Nowhere|Noname|Noclan", $listView)
$item2 = GuiCtrlCreateListViewItem("1.1.1.1|Here|me|Ca", $listView)
$item3 = GuiCtrlCreateListViewItem("2.3.2.1|Where?|now|Three", $listView)
$item4 = GuiCtrlCreateListViewItem("1.5.2.4|", $listView)

While 1
     $msg = GUIGetMsg()

     If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Link to comment
Share on other sites

try it like this :think:

; Script Start - Add your code below here

; USE BETA !!

#include <GUIConstants.au3>

GUICreate("IP Program - By Chobby")

GUISetState(@SW_SHOW)

Opt("TrayIconHide", 1)

Dim $IniFile=@ScriptDir&"\ip.ini"

;List

$listView = GuiCtrlCreateListView("IP|Country|Name|Clan|", 10, 10, 380, 350)

;Items

$item1 = GuiCtrlCreateListViewItem("0.0.0.0|Nowhere|Noname|Noclan", $listView)

$item2 = GuiCtrlCreateListViewItem("1.1.1.1|Here|me|Ca", $listView)

$item3 = GuiCtrlCreateListViewItem("2.3.2.1|Where?|now|Three", $listView)

$item4 = GuiCtrlCreateListViewItem("1.5.2.4|", $listView)

_ReadIniFile()

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

WEnd

func _ReadIniFile()

$inientry=IniReadSectionNames($IniFile)

If not IsArray($inientry) Then

MsgBox(0,"","No Entry")

Else

$IniCount=$inientry[0]

for $i=1 to $IniCount

$entry=IniRead($IniFile,"IPADRESSEN","Adress"&$i,"") &"|"&IniRead($IniFile,"IPADRESSEN","Name"&$i,"")

MsgBox(0,"",$entry)

GUICtrlSetData($item1,$entry)

next

endif

EndFunc

;---------------------------------------------------------------------------------------------------

; Format of Inifile IP.ini

[iPADRESSEN]

Adress1=192.168.0.1

Name1=TestClan1

Adress2=192.168.0.2

Name2=TestClan2

Link to comment
Share on other sites

should work in production and beta

#include <GUIConstants.au3>
Opt("TrayIconHide", 1)
Opt("MustDeclareVars", 1)

_Main()

Func _Main()
    Local $IniFile = @ScriptDir & "\ip.ini"
    Local $listview, $msg
    
    GUICreate("IP Program - By Chobby")
    
;List
    $listview = GUICtrlCreateListView("IP|Country|Name|Clan|", 10, 10, 380, 350)
    
;Items
    _ReadIniFile($IniFile, $listview)

    GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc  ;==>_Main

Func _ReadIniFile(ByRef $IniFile, ByRef $listview)
    
    Local $inientry = IniReadSection($IniFile, "ips")
    If Not IsArray($inientry) Then
        MsgBox(0, "", "No Entry")
    Else
        For $i = 1 To $inientry[0][0]
            GUICtrlCreateListViewItem($inientry[$i][1], $listview)
        Next
    EndIf
EndFunc  ;==>_ReadIniFile

ip.ini

[ips]
1=0.0.0.0|Nowhere|Noname|Noclan
2=1.1.1.1|Here|me|Ca
3=2.3.2.1|Where?|now|Three
4=1.5.2.4|

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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