Jump to content

Array file and dir list


Recommended Posts

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

#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

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

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

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

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

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

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

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

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

#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

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

BUMP

since no one is reader or replying

newest code - so close

#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

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

#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.

 

Link to comment
Share on other sites

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

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

#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

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

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.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

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

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

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

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.

 

Link to comment
Share on other sites

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

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

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

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

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.

 

Link to comment
Share on other sites

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?

#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

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

had same problem at work try:

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

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

had same problem at work try:

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?

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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?

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...