Chobby Posted April 15, 2006 Share Posted April 15, 2006 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 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 More sharing options...
Micha1405 Posted April 15, 2006 Share Posted April 15, 2006 try it like this ; 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 My TrayToolBar Link to comment Share on other sites More sharing options...
GaryFrost Posted April 15, 2006 Share Posted April 15, 2006 should work in production and beta expandcollapse popup#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 More sharing options...
Chobby Posted April 16, 2006 Author Share Posted April 16, 2006 Thank you for the help, so far!! Does any of you have a link to a page (on this forum, as far as i remember) about .ini 'functions'/'features'? That would be great Link to comment Share on other sites More sharing options...
GaryFrost Posted April 16, 2006 Share Posted April 16, 2006 http://www.autoitscript.com/autoit3/docs/f...ons/IniRead.htmhttp://www.autoitscript.com/autoit3/docs/f...ReadSection.htmhttp://www.autoitscript.com/autoit3/docs/f...ectionNames.htmhttp://www.autoitscript.com/autoit3/docs/f...ns/IniWrite.htm 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 More sharing options...
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