Jump to content



Photo

Array file and dir list


  • Please log in to reply
34 replies to this topic

#1 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 12 July 2006 - 11:53 PM

I am trying to break out both the dir and files from a folder. What I want is for each folder to be listed and each file under the folder to be listed as well, but with the folder heading listed as well for those files.


edit - new code - almost there

AutoIt         
#include <GuiConstants.au3> #include <GuiListView.au3> #Include <File.au3> #Include <Array.au3> Dim $Btn_TestScroll, $Btn_Exit, $msg, $Status, $i $dirList = _FileListToArray (@FavoritesDir, '*', 2) If (Not IsArray($dirList)) and (@error = 1) Then     MsgBox(0, "", "No Files\Folders Found.")     Exit EndIf GUICreate("ListView Scroll", 392, 322) $listview = GUICtrlCreateListView("URL", 40, 30, 310, 149) ;$FileList =12 For $TEST1 In $dirList     GUICtrlCreateListViewItem($TEST1, $listview)     $FileList = _FileListToArray (@FavoritesDir & "\" & $TEST1, '*.url', 1)     If (Not IsArray($FileList)) and (@error = 1) Then         MsgBox(0, "", "No Files\Folders Found.")         Exit     EndIf         $rows = UBound($FileList)     $dims = UBound($FileList, 0)         For $r = 0 To UBound($FileList, 1) - 1             For $dims in $FileList -$r                 GUICtrlCreateListViewItem($dims, $listview)             Next     Next Next $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() 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


When I do this I get each folder listed countless times. Can anyone point me in the right direction.

Thanks

EDIT =- Changed code - but same thing happens
EDIT 2 - thought I found my error - but now it says it must be declared as an object?

Edited by nitekram, 13 July 2006 - 02:34 AM.






#2 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 13 July 2006 - 12:08 AM

BUMP - plus I changed the code - but still same issue.

#3 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 13 July 2006 - 12:13 AM

BUMP - plus I changed the code - but still same issue.



Never mind I found it - I had declared a variable and never took it out.

Edit - I feal really stupid saying I found it - but it still is messed up - any help

Edited by nitekram, 13 July 2006 - 12:15 AM.


#4 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 13 July 2006 - 12:58 AM

Never mind I found it - I had declared a variable and never took it out.

Edit - I feal really stupid saying I found it - but it still is messed up - any help



OK - I have to BUMP this as I believe those that read it the last time might have thought that I was able to figure it out. I think I need to use Ubound but I am unable to figure it out.

EDIT - Added code that I am trying to figure out.

EDIT - Cleand up code with TidyIT

EDIT - DELETED CODE - ALL $#$!#$$!##$ UP - I have no clue. Can you tell?

Edited by nitekram, 13 July 2006 - 01:14 AM.


#5 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 13 July 2006 - 01:32 AM

OK - I have to BUMP this as I believe those that read it the last time might have thought that I was able to figure it out. I think I need to use Ubound but I am unable to figure it out.

EDIT - Added code that I am trying to figure out.

EDIT - Cleand up code with TidyIT

EDIT - DELETED CODE - ALL $#$!#$$!##$ UP - I have no clue. Can you tell?

OK - Please help
New Code - still does not do what I want
AutoIt         
#include <GuiConstants.au3> #include <GuiListView.au3> #Include <File.au3> #Include <Array.au3> Dim $Btn_TestScroll, $Btn_Exit, $msg, $Status, $i $dirList=_FileListToArray(@FavoritesDir,'*',2) If (Not IsArray($dirList)) and (@Error=1) Then     MsgBox (0,"","No Files\Folders Found.")     Exit EndIf GUICreate("ListView Scroll", 392, 322) $listview = GUICtrlCreateListView("URL",40, 30, 310, 149) For $TEST1 IN $dirlist GUICtrlCreateListViewItem($TEST1, $listview) $FileList=_FileListToArray(@FavoritesDir & "\" & $TEST1,'*.url',1) If (Not IsArray($FileList)) and (@Error=1) Then     MsgBox (0,"","No Files\Folders Found.")     Exit EndIf $rows = UBound($FileList) $dims = UBound($FileList, 0) ;MsgBox(0, "The " & $dims & "-dimensional array has", _ ;    $rows & " rows, " & $cols & " columns") ;Display $myArray's contents $output = "" For $r = 0 to UBound($FileList,1) - 1     $output = $output & @LF Next ;MsgBox(4096,"Array Contents", $output) ;MsgBox (0,"test", $output) GUICtrlCreateListViewItem($fileList[$rows], $listview)     Next $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() 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


#6 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 13 July 2006 - 01:58 AM

BUMP
since no one is reader or replying

newest code - so close

AutoIt         
#include <GuiConstants.au3> #include <GuiListView.au3> #Include <File.au3> #Include <Array.au3> Dim $Btn_TestScroll, $Btn_Exit, $msg, $Status, $i $dirList=_FileListToArray(@FavoritesDir,'*',2) If (Not IsArray($dirList)) and (@Error=1) Then     MsgBox (0,"","No Files\Folders Found.")     Exit EndIf GUICreate("ListView Scroll", 392, 322) $listview = GUICtrlCreateListView("URL",40, 30, 310, 149) ;$FileList =12 For $TEST1 IN $dirlist GUICtrlCreateListViewItem($TEST1, $listview) $FileList=_FileListToArray(@FavoritesDir & "\" & $TEST1,'*.url',1) If (Not IsArray($FileList)) and (@Error=1) Then     MsgBox (0,"","No Files\Folders Found.")     Exit EndIf $rows = UBound($FileList) $dims = UBound($FileList, 0) ;MsgBox(0, "The " & $dims & "-dimensional array has", _ ;    $rows & " rows, " & $cols & " columns") ;Display $myArray's contents For $r = 0 to UBound($FileList,1) - 1     GUICtrlCreateListViewItem($r, $listview)     $FileList=_FileListToArray(@FavoritesDir & "\" & $TEST1,'*.url',1)         If (Not IsArray($FileList)) and (@Error=1) Then             MsgBox (0,"","No Files\Folders Found.")         Exit         EndIf For $rows in $fileList     GUICtrlCreateListViewItem($rows, $listview)     Next Next ;MsgBox(4096,"Array Contents", $output) ;MsgBox (0,"test", $output)     Next #cs For $test2 in  $fileList     GUICtrlCreateListViewItem($TEST1, $listview) Next #ce $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() 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


#7 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 13 July 2006 - 02:32 AM

AutoIt         
#include <GuiConstants.au3> #include <GuiListView.au3> #Include <File.au3> #Include <Array.au3> Dim $Btn_TestScroll, $Btn_Exit, $msg, $Status, $i GUICreate("ListView Scroll", 392, 322) $listview = GUICtrlCreateListView("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         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)             ;================================================================================================             ; not sure what your trying to do here ;~          $FileList2 = _FileListToArray(@FavoritesDir & "\" & $dirList[$TEST1], '*.url', 1) ;~          If (Not IsArray($FileList)) and (@error = 1) Then ;~              MsgBox(0, "", "No Files\Folders Found.") ;~              Exit ;~          EndIf ;~ ;~          For $rows = 1 To $FileList2[0] ;~              GUICtrlCreateListViewItem($FileList2[$rows], $listview) ;~          Next             ;================================================================================================         Next     Next EndFunc   ;==>_LoadListView

SciTE for AutoItDirections for Submitting Standard UDFs

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


#8 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 13 July 2006 - 02:33 AM

Bump - I added the newest code to the first post - it is really close now. If anyone wants to help - please do.

#9 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 13 July 2006 - 03:10 AM

Close?

SciTE for AutoItDirections for Submitting Standard UDFs

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


#10 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 13 July 2006 - 03:33 AM

AutoIt         
#include <GuiConstants.au3> #include <GuiListView.au3> #Include <File.au3> #Include <Array.au3> Dim $Btn_TestScroll, $Btn_Exit, $msg, $Status, $i GUICreate("ListView Scroll", 392, 322) $listview = GUICtrlCreateListView("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         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)             ;================================================================================================             ; not sure what your trying to do here ;~          $FileList2 = _FileListToArray(@FavoritesDir & "\" & $dirList[$TEST1], '*.url', 1) ;~          If (Not IsArray($FileList)) and (@error = 1) Then ;~              MsgBox(0, "", "No Files\Folders Found.") ;~              Exit ;~          EndIf ;~ ;~          For $rows = 1 To $FileList2[0] ;~              GUICtrlCreateListViewItem($FileList2[$rows], $listview) ;~          Next             ;================================================================================================         Next     Next EndFunc   ;==>_LoadListView

I thank you and wish that I had seen your reply an hour ago - my mind hurts from changing things around - and I still never got close. I am going to study this code and see what I do not understand and hope to ask more questions. I have to go to bed :D as I am done for the night.

Again I thank you and would have never ever been able to do this without your help. I wish I just could get this.

EDIT - you never even used Ubound() - now I am completly lost.

Edited by nitekram, 13 July 2006 - 03:36 AM.


#11 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 13 July 2006 - 02:25 PM

Close?

Well I thought I was close - meaning that the folders were displaying and the files were displaying - just the files were displaying 3 times 3. I know have taken a look at your code and found that you are using [0] for what I was trying to use Ubound() for. Is there another example of using Ubound() as I have stated in another post - $output does not display anything (from the help file).

Here is the thread in question.
http://www.autoitscript.com/forum/index.ph...c=29062&hl=

Thanks for any help - I am still trying to understand these terms and the way they work together.

#12 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 13 July 2006 - 02:31 PM

Well I thought I was close - meaning that the folders were displaying and the files were displaying - just the files were displaying 3 times 3. I know have taken a look at your code and found that you are using [0] for what I was trying to use Ubound() for. Is there another example of using Ubound() as I have stated in another post - $output does not display anything (from the help file).

Here is the thread in question.
http://www.autoitscript.com/forum/index.ph...c=29062&hl=

Thanks for any help - I am still trying to understand these terms and the way they work together.

well being you are using _FileListToArray, the [0] = Number of Files\Folders returned

you only need to use UBound if you don't know the size of the array

quick example:

Dim $array[Random(1,100,1)] MsgBox(0,"Ubound",UBound($array))

The example doesn't populate anything into the array, therefore the msgbox displays nothing but line feeds.

Edited by gafrost, 13 July 2006 - 02:36 PM.

SciTE for AutoItDirections for Submitting Standard UDFs

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


#13 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 13 July 2006 - 02:41 PM

maybe this minor change to that example will help you better:

AutoIt         
Dim $myArray[10][20]   ;element 0,0 to 9,19 $rows = UBound($myArray) $cols = UBound($myArray, 2) $dims = UBound($myArray, 0) MsgBox(0, "The " & $dims & "-dimensional array has", _         $rows & " rows, " & $cols & " columns") ; populate for display purposes For $r = 0 To UBound($myArray, 1) - 1     For $c = 0 To UBound($myArray, 2) - 1         $myArray[$r][$c] = $c     Next Next ;Display $myArray's contents $output = "" For $r = 0 To UBound($myArray, 1) - 1     $output = $output & @LF     For $c = 0 To UBound($myArray, 2) - 1         $output = $output & $myArray[$r][$c] & " "     Next Next MsgBox(4096, "Array Contents", $output)

SciTE for AutoItDirections for Submitting Standard UDFs

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


#14 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 13 July 2006 - 03:22 PM

maybe this minor change to that example will help you better:

AutoIt         
Dim $myArray[10][20]   ;element 0,0 to 9,19 $rows = UBound($myArray) $cols = UBound($myArray, 2) $dims = UBound($myArray, 0) MsgBox(0, "The " & $dims & "-dimensional array has", _         $rows & " rows, " & $cols & " columns") ; populate for display purposes For $r = 0 To UBound($myArray, 1) - 1     For $c = 0 To UBound($myArray, 2) - 1         $myArray[$r][$c] = $c     Next Next ;Display $myArray's contents $output = "" For $r = 0 To UBound($myArray, 1) - 1     $output = $output & @LF     For $c = 0 To UBound($myArray, 2) - 1         $output = $output & $myArray[$r][$c] & " "     Next Next MsgBox(4096, "Array Contents", $output)

I guess my confusion is that Ubound is for arrays that are unknown (as you stated) - yet in the help file example, the array is defined as $myArray[10][20]. But now that you have given an example it is a little clearer (like mud :D)

I am going to do some searches on the forum and read some more.

Thanks again

#15 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 13 July 2006 - 03:27 PM

being you do know the dimensions of the array it could of been written as such:

AutoIt         
Dim $myArray[10][20]   ;element 0,0 to 9,19 $rows = UBound($myArray) $cols = UBound($myArray, 2) $dims = UBound($myArray, 0) MsgBox(0, "The " & $dims & "-dimensional array has", _         $rows & " rows, " & $cols & " columns") ; populate for display purposes For $r = 0 To 9     For $c = 0 To 19         $myArray[$r][$c] = $c     Next Next ;Display $myArray's contents $output = "" For $r = 0 To 9     $output = $output & @LF     For $c = 0 To 19         $output = $output & $myArray[$r][$c] & " "     Next Next MsgBox(4096, "Array Contents", $output)

SciTE for AutoItDirections for Submitting Standard UDFs

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


#16 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 14 July 2006 - 04:58 PM

Sorry about this - but I copied the code from the forum - removed comments for the most part and then got an error. But the same script runs fine on my home PC - any ideas?

AutoIt         
#include <GuiConstants.au3> #include <GuiListView.au3> #Include <File.au3> #Include <Array.au3> Dim $Btn_TestScroll, $Btn_Exit, $msg, $Status, $i GUICreate("ListView Scroll", 392, 322) $listview = GUICtrlCreateListView("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         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


The error I receive is:
>Running: (3.1.1.111):C:\Program Files\AutoIt3\beta\autoit3.exe "Z:\scripts\favorites_list.au3"
Z:\scripts\favorites_list.au3 (56) : ==> Subscript used with non-Array variable.:

EDIT - on difference between the computers - I have a lot more favorites on my work computer than my home computer - could that be the cause?

Edited by nitekram, 14 July 2006 - 05:00 PM.


#17 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 14 July 2006 - 05:04 PM

had same problem at work try:

AutoIt         
Func _LoadListView(ByRef $listview)     $dirList = _FileListToArray(@FavoritesDir, '*', 2)     If (Not IsArray($dirList)) Or (@error = 1) Then         MsgBox(0, "", "No Files\Folders Found.")         Return     EndIf         For $TEST1 = 1 To $dirList[0]         GUICtrlCreateListViewItem($dirList[$TEST1], $listview)                         $FileList = _FileListToArray(@FavoritesDir & "\" & $dirList[$TEST1], '*.url', 1)         If (Not IsArray($FileList)) Or (@error = 1) Then             ContinueLoop         EndIf                 ;Display $myArray's contents         For $r = 1 To $FileList[0]             GUICtrlCreateListViewItem($dirList[$TEST1] & " :--: " & $FileList[$r], $listview)         Next     Next EndFunc

Edited by gafrost, 14 July 2006 - 05:05 PM.

SciTE for AutoItDirections for Submitting Standard UDFs

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


#18 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 14 July 2006 - 05:20 PM

had same problem at work try:

AutoIt         
Func _LoadListView(ByRef $listview)     $dirList = _FileListToArray(@FavoritesDir, '*', 2)     If (Not IsArray($dirList)) Or (@error = 1) Then         MsgBox(0, "", "No Files\Folders Found.")         Return     EndIf         For $TEST1 = 1 To $dirList[0]         GUICtrlCreateListViewItem($dirList[$TEST1], $listview)                         $FileList = _FileListToArray(@FavoritesDir & "\" & $dirList[$TEST1], '*.url', 1)         If (Not IsArray($FileList)) Or (@error = 1) Then             ContinueLoop         EndIf                 ;Display $myArray's contents         For $r = 1 To $FileList[0]             GUICtrlCreateListViewItem($dirList[$TEST1] & " :--: " & $FileList[$r], $listview)         Next     Next EndFunc

That worked - can you explain why?

#19 GaryFrost

GaryFrost

    I don't need your attitude. I have one of my own

  • Developers
  • 7,854 posts

Posted 14 July 2006 - 05:31 PM

looking at the function in the include error is not set but 0 is returned when no files are found.

To my thinking error should be set in this scenario also.

SciTE for AutoItDirections for Submitting Standard UDFs

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


#20 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,622 posts

Posted 14 July 2006 - 05:46 PM

looking at the function in the include error is not set but 0 is returned when no files are found.

To my thinking error should be set in this scenario also.

So, because I have folders at work that include folders and no files the first code did not work, but because it continues the loop either way in the second code it worked?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users