DVHRLD Posted July 30, 2008 Share Posted July 30, 2008 How can I take an ini section and put it into a ListBoxHere is what I have so far with the script not being able to run.Thanks for your help... again.MyScript.au3#include <Array.au3> #include <GUIConstantsEx.au3> #include <file.au3> #Include <GuiListBox.au3> $proxylist = StringSplit(IniReadSection("MyIni.ini", "Proxy")"|") For $I = 1 To $proxylist[0] GUICtrlCreateListViewItem($proxylist[$I], $proxlist) Next _GUICtrlListBox_UpdateHScroll($proxlist) _GUICtrlListBox_EndUpdate($proxlist) $gui = GUICreate("My Gui", 430, 120) $proxies = GUICtrlCreateTabItem("Proxies") $proxlist = GUICtrlCreateList($proxylist, 10, 20, 200, 80) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete()MyIni.ini[Url] url1=http://google.com url2=http://msn.com url3=http://google.ca url4=http://yahoo.com [Proxy] 128.112.139.71:3128 128.112.139.75:3128 128.112.139.78:3128 AutoViewer first public AutoIt script Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 30, 2008 Moderators Share Posted July 30, 2008 Take a look at IniReadSection, it returns an Array(). You can't use "String" functions on an array. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
smashly Posted July 30, 2008 Share Posted July 30, 2008 Hi, #include <GUIConstantsEx.au3> Global $Ini = @ScriptDir & "\MyIni.ini" $gui = GUICreate("My Gui", 430, 120) $Tab0 = GUICtrlCreateTab(5, 5, 420, 110) $Urls = GUICtrlCreateTabItem("Url") $urllist = GUICtrlCreateList("", 10, 35, 200, 80) _FillList($urllist, $Ini, "Url") $proxies = GUICtrlCreateTabItem("Proxies") $proxlist = GUICtrlCreateList("", 10, 35, 200, 80) _FillList($proxlist, $Ini, "Proxy") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW, $gui) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case Else ;;; EndSwitch WEnd Func _FillList($cID, $IniPath, $sSection) Local $aSection = IniReadSection($IniPath, $sSection) If Not @error Then For $i = 1 To $aSection[0][0] GUICtrlSetData($cID, $aSection[$i][1]) Next EndIf EndFunc For your ini you need to add keys for the [Proxies] section for the example to work.. [Url] url1=http://google.com url2=http://msn.com url3=http://google.ca url4=http://yahoo.com [Proxy] 1=128.112.139.71:3128 2=128.112.139.75:3128 3=128.112.139.78:3128 Cheers Link to comment Share on other sites More sharing options...
DVHRLD Posted July 30, 2008 Author Share Posted July 30, 2008 (edited) OK thanks smashly Edited July 30, 2008 by DVHRLD AutoViewer first public AutoIt script 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