Why does this not work? In the code everything works but the part that I am asking about. Not sure if I code it right, but the first msgbox() shows the file, how come it does not read the second line or anyline?
#include <GuiConstants.au3>
#include <GuiListView.au3>
#Include <File.au3>
#Include <Array.au3>
Dim $Btn_TestScroll, $Btn_Exit, $msg, $Status, $i, $line2
GUICreate("ListView Scroll", 392, 322)
$listview = GUICtrlCreateListView("URL List|URL", 40, 30, 310, 149)
_GUICtrlListViewSetColumnWidth($listview, 0, $LVSCW_AUTOSIZE_USEHEADER)
$Btn_TestScroll = GUICtrlCreateButton("Scroll Test", 150, 230, 90, 40)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
$Status = GUICtrlCreateLabel("Remember items are zero-indexed", 0, 302, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
GUISetState()
_LoadListView($listview)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_TestScroll
For $i = 10 To 50 Step 10
_GUICtrlListViewScroll($listview, 0, $i)
Sleep(500)
_GUICtrlListViewScroll($listview, 0, $i - ($i * 2))
Sleep(500)
Next
EndSelect
WEnd
Exit
Func _LoadListView(ByRef $listview)
$dirList = _FileListToArray(@FavoritesDir, '*', 2)
If (Not IsArray($dirList)) and (@error = 1) Then
MsgBox(0, "", "No Files\Folders Found.")
Exit
EndIf
$fileListurl = _FileListToArray(@FavoritesDir, '*.url', 1)
If (Not IsArray($fileListurl)) and (@error = 1) Then
MsgBox(0, "", "No Files\Folders Found.")
Exit
EndIf
For $test3 = 1 To $fileListurl[0]
; Why does this not work?
MsgBox(0, $fileListurl[$test3], "")
FileOpen($fileListurl[$test3], 0)
$line2 = FileReadLine($fileListurl[$test3], 2)
MsgBox(0, "", $line2)
FileClose($fileListurl[$test3])
; above code does not work
GUICtrlCreateListViewItem($fileListurl[$test3] & "|" & "$line2", $listview)
Next
For $TEST1 = 1 To $dirList[0]
GUICtrlCreateListViewItem($dirList[$TEST1], $listview)
$FileList = _FileListToArray(@FavoritesDir & "\" & $dirList[$TEST1], '*.url', 1)
If (Not IsArray($FileList)) and (@error = 1) Then
MsgBox(0, "", "No Files\Folders Found.")
Exit
EndIf
;Display $myArray's contents
For $r = 1 To $FileList[0]
GUICtrlCreateListViewItem($dirList[$TEST1] & " :--: " & $FileList[$r], $listview)
Next
Next
EndFunc ;==>_LoadListView