walle Posted July 31, 2007 Share Posted July 31, 2007 I've been using a rss reader to collect some information about .torrent files (the titles) and saved it into a .ini file. Now I would like to put the information in a listbox. The problem is that I can't figure out how to but all the rows/lines into the listbox. Not only the first one (Swedvdr.org). Any idea? $READ = IniRead(@HomeDrive & "\Temp\Burnbuddy.ini", "Section5", "RSS", "NotFound") GUICtrlSetData($Listbox2,$READ) Inifile [Section5] swedvdr.org Autoit1XXX Autoit2XXX Autoit3XXX Autoit4XXX Autoit5XXX Autoit6XXX Autoit7XXX Autoit8XXX Link to comment Share on other sites More sharing options...
Danny35d Posted July 31, 2007 Share Posted July 31, 2007 You need to use IniReadSection()Example$READ = IniReadSection(@HomeDrive & "\Temp\Burnbuddy.ini", "Section5") For $x = 1 To $READ[0][0] _GUICtrlListAddItem ($Listbox2, $READ[$x][0]) NextNote:Don't forget to be able to use __GUICtrlListAddItem() you need to include GuiList.au3 AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
walle Posted July 31, 2007 Author Share Posted July 31, 2007 (edited) You need to use IniReadSection() Example $READ = IniReadSection(@HomeDrive & "\Temp\Burnbuddy.ini", "Section5") For $x = 1 To $READ[0][0] _GUICtrlListAddItem ($Listbox2, $READ[$x][0]) Next Note: Don't forget to be able to use __GUICtrlListAddItem() you need to include GuiList.au3 Still it only reads the first/ adding the first line =/ Thanks for replay anyway. INIFILE RSS=swedvdr.org Autoit1 Autoit2 Autoit3 Autoit4 Autoit5 Edited July 31, 2007 by walle Link to comment Share on other sites More sharing options...
GMK Posted July 31, 2007 Share Posted July 31, 2007 (edited) Still it only reads the first/ adding the first line =/ Thanks for replay anyway. INIFILE RSS=swedvdr.org Autoit1 Autoit2 Autoit3 Autoit4 Autoit5Try INIFILE[Section5] RSS=swedvdr.org RSS=Autoit1 RSS=Autoit2 RSS=Autoit3 RSS=Autoit4 RSS=Autoit5 Edited July 31, 2007 by GMK Link to comment Share on other sites More sharing options...
walle Posted July 31, 2007 Author Share Posted July 31, 2007 Here is the Rss reader, don't know if that helps expandcollapse popup#include <array.au3> #Include <Inet.au3> $source = _INetGetSource("http://www.swedvdr.org/rss") $a = _StrBetween($source, "<title>", "</title>") GUISetState() Global $text For $i = 0 to UBound($a) -1 $text &= $a[$i] & @CRLF Next ;GUICtrlSetData($Edit, $text & @CRLF) IniWrite(@HomeDrive & "\Temp\Burnbuddy.ini", "Section5", "RSS", $text) While 1 Sleep(2000) WEnd Func _StrBetween($sString, $sStart, $sEnd, $vCase = -1, $iSRE = -1) If $iSRE = -1 Or $iSRE = Default Then If $vCase = -1 Or $vCase = Default Then $vCase = 0 If $vCase <> -1 And $vCase <> Default Then $vCase = 1 Local $sHold = '', $sSnSStart = '', $sSnSEnd = '' While StringLen($sString) > 0 $sSnSStart = StringInStr($sString, $sStart, $vCase) If Not $sSnSStart Then ExitLoop $sString = StringTrimLeft($sString, ($sSnSStart + StringLen($sStart)) - 1) $sSnSEnd = StringInStr($sString, $sEnd, $vCase) If Not $sSnSEnd Then ExitLoop $sHold &= StringLeft($sString, $sSnSEnd - 1) & Chr(1) $sString = StringTrimLeft($sString, $sSnSEnd) WEnd If Not $sHold Then Return SetError(1, 0, 0) $sHold = StringSplit(StringTrimRight($sHold, 1), Chr(1)) Local $aArray[UBound($sHold) - 1] For $iCC = 1 To UBound($sHold) - 1 $aArray[$iCC - 1] = $sHold[$iCC] Next Return $aArray Else If $vCase = Default Or $vCase = -1 Then $vCase = '(?i)' If $vCase <> Default And $vCase <> -1 Then $vCase = '' Local $aArray = StringRegExp($sString, '(?s)' & $vCase & $sStart & '(.*?)' & $sEnd, 3) If IsArray($aArray) Then Return $aArray Return SetError(1, 0, 0) EndIf EndFunc Link to comment Share on other sites More sharing options...
GMK Posted July 31, 2007 Share Posted July 31, 2007 (edited) Would it work better to separate your RSS entries with commas, instead of @CRLF? Then you could do a StringSplit and insert that array into the ListBox. Edit: Does InetGetSource work for this? When I try it, it doesn't bring up the same thing and seems as if a login is necessary. There might be a cookie stored in your session that logs you in automatically, but I was just curious. Edited July 31, 2007 by GMK Link to comment Share on other sites More sharing options...
walle Posted July 31, 2007 Author Share Posted July 31, 2007 Would it work better to separate your RSS entries with commas, instead of @CRLF? Then you could do a StringSplit and insert that array into the ListBox.Edit: Does InetGetSource work for this? When I try it, it doesn't bring up the same thing and seems as if a login is necessary. There might be a cookie stored in your session that logs you in automatically, but I was just curious.A login is indeed necessary... You are probably right, damn I hate does listboxes >_> Link to comment Share on other sites More sharing options...
GMK Posted July 31, 2007 Share Posted July 31, 2007 Just a thought: You may be able to get what you need with the IE UDF functions. Link to comment Share on other sites More sharing options...
Danny35d Posted July 31, 2007 Share Posted July 31, 2007 Like GMK mention in post #4 try creating the ini file like this one: [section5] RSS=swedvdr.org RSS=Autoit1 RSS=Autoit2 RSS=Autoit3 RSS=Autoit4 RSS=Autoit5I tried the code below and work for me as long the ini file is created as the one above: #include <GUIConstants.au3> #include <GUIList.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Listbox", 250, 270, 193, 115) $Listbox2 = GUICtrlCreateList("", 8, 16, 225, 201) $Button1 = GUICtrlCreateButton("Close", 80, 232, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $READ = IniReadSection(@HomeDrive & "\Temp\Burnbuddy.ini", "Section5") For $x = 1 To $READ[0][0] _GUICtrlListAddItem ($Listbox2, $READ[$x][1]) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Button1 Exit EndSwitch WEnd AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
walle Posted August 1, 2007 Author Share Posted August 1, 2007 Like GMK mention in post #4 try creating the ini file like this one: I tried the code below and work for me as long the ini file is created as the one above: #include <GUIConstants.au3> #include <GUIList.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Listbox", 250, 270, 193, 115) $Listbox2 = GUICtrlCreateList("", 8, 16, 225, 201) $Button1 = GUICtrlCreateButton("Close", 80, 232, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $READ = IniReadSection(@HomeDrive & "\Temp\Burnbuddy.ini", "Section5") For $x = 1 To $READ[0][0] _GUICtrlListAddItem ($Listbox2, $READ[$x][1]) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Button1 Exit EndSwitch WEnd Worked like a charm, but, still need some changes in the rss reader. Tried this, IniWrite(@HomeDrive & "\Temp\Burnbuddy.ini", "Section5", "RSS", "RSS=" & $text) Need "RSS=" before Autoit2,autoit3,autoit4,autoit5. Any idea? //Walle Link to comment Share on other sites More sharing options...
GMK Posted August 1, 2007 Share Posted August 1, 2007 Where do Autoit2,autoit3,autoit4,autoit5 come from? Link to comment Share on other sites More sharing options...
Danny35d Posted August 1, 2007 Share Posted August 1, 2007 Going by your code in post #5: changeFor $i = 0 to UBound($a) -1 $text &= $a[$i] & @CRLF Next ;GUICtrlSetData($Edit, $text & @CRLF) IniWrite(@HomeDrive & "\Temp\Burnbuddy.ini", "Section5", "RSS", $text) ForFor $i = 0 to UBound($a) -1 IniWrite(@HomeDrive & "\Temp\Burnbuddy.ini", "Section5", $i, $a[$i]) Next This will create a ini file like the one below which also work with the code in post #9 [Section5] 0=swedvdr.org 1=Autoit1 2=Autoit2 3=Autoit3 4=Autoit4 5=Autoit5 AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
walle Posted August 1, 2007 Author Share Posted August 1, 2007 Thank you! Link to comment Share on other sites More sharing options...
GMK Posted August 2, 2007 Share Posted August 2, 2007 It sounds like you're getting closer to your goal, but instead of writing to an INI file to be read into a listbox, wouldn't it be more efficient to just write into the listbox--skipping the "middle man?" 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