Jump to content

RecFileListToArray - Deprecated


Melba23
 Share

Recommended Posts

  • Moderators

johnmcloud,

A good start but I hope you do not mind if I suggest a few improvements: :)

- Reorder the include/exclude inputs by putting the "Folder Exclude" under the 2 "File/Folder Include/Exclude" lines so that the 3 reflect the order used in the UDF parameter.

- Adjust the "Folder Exclude" input so that it only shows the folder name and not the whole path as that is what the UDF uses (I can help you develop a Regex to do that). Also use the selected path as the root of the "Folder Exclude" folder selection dialog - after all the folders chosen need to be on that path! ;)

- Restore the tooltips to the include/exclude inputs that were in the original script which explained how to add multiple filters by using ";".

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

johnmcloud,

A good start but I hope you do not mind if I suggest a few improvements: :)

Absolutely not :D

I have updated my previus post with your suggestion, check it out ( P.S You have tested any type of combination? I doubt that i have made ​​some mistake :D )

Next time i'll add the ArrayDisplay with the other GUI

For the "folder name and not the whole path", i have used:

GUICtrlSetData($FolderOutput, StringRegExpReplace(StringTrimRight($Dir, 1), '.*\\|\.[^.]*$', ''))

My StringRegExpReplace work with path like

C:TestMyFolder

But the path for the UDF is

C:TestMyFolder

I don't know how to make everything with only one StringRegExpReplace insead to use StringTrimRight before

Link to comment
Share on other sites

  • Moderators

johnmcloud,

Very nice - a suggested change to the code to help with the path and folder inputs (only using a single RegEx ;)):

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button_InputPath
            _Select_Folder($InputPath) ; This selection should not be limited <<<<<<<<<<<<
        Case $Button_InputPathExclude
            _Select_Folder($InputPathExclude, GUICtrlRead($InputPath), 1) ; Reordered parameters <<<<<<<<<<<<<
        Case $Button_Generate
            _Generate_RecFileListToArray()
    EndSwitch
WEnd

Func _Select_Folder($FolderOutput, $StartPath = "", $FolderName = 0) ; Reordered parameters <<<<<<<<<<<<<<<
    $Dir = FileSelectFolder("", $StartPath, 2, @ScriptDir)
    If @error Then
        ; Clear the input
        GUICtrlSetData($FolderOutput, "")
    Else
        Switch $FolderName
            Case 0
                ; We return the folder as a path
                ; This is where you would add the trailing "\" if required <<<<<<<<<<<<<<<<<<<<<<<<<
                GUICtrlSetData($FolderOutput, $Dir)
            Case 1
                ; We return only the name
                $sName = StringRegExpReplace($Dir, "^.*\\(.*)$", "$1")
                If GUICtrlRead($FolderOutput) Then
                    GUICtrlSetData($FolderOutput, GUICtrlRead($FolderOutput) & ";" & $sName)
                Else
                    GUICtrlSetData($FolderOutput, $sName)
                EndIf
        EndSwitch
    EndIf
EndFunc   ;==>_Select_Folder

And one more suggestion - add a checkbox to ask if the path should have a trailing "" and then do it if required at the point I indicate. :)

Finally, are you going to have some simple error-checking? For example if folders are to be excluded, the UDF must be set up to return both files and folder and recur. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

johnmcloud,

Very nice - a suggested change to the code to help with the path and folder inputs (only using a single RegEx ;))

Done ;)

And one more suggestion - add a checkbox to ask if the path should have a trailing "" and then do it if required at the point I indicate. :)

Instead of a checkbox, it's better to do this? Automatically add a slash to the path if need

Switch $FolderName
   Case 0
    If StringRight($Dir, 1) <> "\" Then
     GUICtrlSetData($FolderOutput, $Dir & "\")
    Else
     GUICtrlSetData($FolderOutput, $Dir)
    EndIf

Finally, are you going to have some simple error-checking? For example if folders are to be excluded, the UDF must be set up to return both files and folder and recur. ;)

M23

If you say how i need to setup i'll do it, write it in a simple way like

If "Path exclude folder" is selected Then Set "Return both files and folders (Default)" And Set "Search in all subfolders (unlimited)"

Or i'll not understand you :D

Edited by johnmcloud
Link to comment
Share on other sites

  • Moderators

johnmcloud,

Personally, I do think that having an option for the trailing "" is worth it - but you are the one coding this GUI so you choose. :D

If you do want to add one automatically then all you have to do is add it - FileSelectFolder only returns a trailing "" on a drive root and then it does not matter if you have 2 of them ("C:" works just as well as "C:"). ;)

And I suggest you forget error-checking - all you are doing is helping with syntax and it woudl only complicate things. :)

M23

Edit:

You can always use this regex to force a single trailign slash if you wish:

$sPath = "C:\Test\Test"
$sPath = StringRegExpReplace($sPath & "\", "(\\+)", "\\")

$sPath_Slash = "C:\Test\Test\"
$sPath_Slash = StringRegExpReplace($sPath_Slash & "\", "(\\+)", "\\")

MsgBox(0, "Result", $sPath & @CRLF & $sPath_Slash)
Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

I finally got around to giving this UDF a whirl today, and wanted to say great work as always :) I did notice one item, on page 1 of this discussion. In your example, you have something akin to what is below for returning an array of everything except .exe files:

$aArray = _RecFileListToArray($sAutoItDir, "*|*.exe", 1, 0, 1, 0)
ConsoleWrite("Error: " & @error & " - " & " Extended: " & @extended & @CRLF)
_ArrayDisplay($aArray, "Non .EXE files")

For me, this returns an error of 1 (Extended 2, invalid include list). I have had to do it like this. Just curious if this was just a typo in the example, or if I am doing something incorrectly:

Local $aArray = _RecFileListToArray($sAutoItDir, "*", 1, 0, 1, 0, "*.exe")
_ArrayDisplay($aArray)
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

JLogan3o13,

Alas I cannot reproduce that error with either the code from the post itself (whch does sometimes get corrupted by the forum software) or the code in the zip. Both versions of the syntax work perfectly. :)

The change to the "include/exclude" list syntax was only introduced in the last release - earlier versions will indeed return those error settings when used with "*|*.exe" and work with the separated lists. Are you sure you have the most recent version of the UDF from the first page of the thread. :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

johnmcloud,

There was a major problem in the "Hidden/System/Link" checkbox code - it was only applying these additional checks when the UDF was returning folders and not in all cases. You need to replace lines #127-#146 with this code:

If GUICtrlRead($ComboFileFolder) = "Return both files and folders (Default)" Then
    $FileFolder = "0"
ElseIf GUICtrlRead($ComboFileFolder) = "Return files only" Then
    $FileFolder = "1"
Else
    $FileFolder = "2"
EndIf
Local $HiddenFiles_Folder, $SystemFiles_Folder, $LinkJuction_Folder
If GUICtrlRead($CheckboxHiddenFiles_Folder) = $GUI_CHECKED Then
    $HiddenFiles_Folder = " + 4"
EndIf
If GUICtrlRead($CheckboxSystemFiles_Folder) = $GUI_CHECKED Then
    $SystemFiles_Folder = " + 8"
EndIf
If GUICtrlRead($CheckboxLinkJuction_Folder) = $GUI_CHECKED Then
    $LinkJuction_Folder = " + 16"
EndIf
$FileFolder &= $HiddenFiles_Folder & $SystemFiles_Folder & $LinkJuction_Folder

Now it applies the additional values in all cases. :)

Other than that it looks very nice - congratulations. :thumbsup:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

johnmcloud,

There was a major problem in the "Hidden/System/Link" checkbox code - it was only applying these additional checks when the UDF was returning folders and not in all cases. You need to replace lines #127-#146 with this code:

Now it applies the additional values in all cases. :)

Other than that it looks very nice - congratulations. :thumbsup:

That wasn't a bug, but was a feature :D

I misunderstood the function and i have updated the code

Thanks

johnmcloud

Lock the parent window when opening a child.

During the test, you can add the output of search time.

Done for both but i don't have understood:

Trim options on the right, if they are by default

Edited by johnmcloud
Link to comment
Share on other sites

  • Moderators

johnmcloud,

That wasn't a bug, but was a feature

:lol:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

AZJIO, Melba,

I have update the GUI:

I have removed from the ConsoleWrite/Editbox the default parameter, please check it out if it is error-bug free.

I have also add the disable-enable input for the Exclude Folder based on Combobox selection, I hope that is correct.

Edited by johnmcloud
Link to comment
Share on other sites

AZJIO, Melba,

I have update the GUI:

I have removed from the ConsoleWrite/Editbox the default parameter, please check it out if it is error-bug free.

I have also add the disable-enable input for the Exclude Folder based on Combobox selection, I hope that is correct.

I think is perfect, congrats :D

But wait other expert, then we'll see your GUI in the first post ;)

I have a question for @Melba23, why:

Relative to initial path (Default)

Is equal to ONE and not ZERO? All other default values are zeros :D

Edited by OliverA

I'M QUIT FROM THIS FORUM!

It was fun until it lasted, hope on my future way i can't find people that offend without any reason ( i was called lazy and parasitic, and everyone agreed...United we stand, divided we fall ) just for fun because don't have anything to do in the life, without knowing anything about the person who write, noone forced to post, noone forced to help.

From the top of the from their very great superiority they not go down to my level, that people can not spread the knowledge but you have to learn by yourself.

In what way? It's easy...just search on google

For that people, wish you the best way,

Oliver Astone

Link to comment
Share on other sites

  • Moderators

OliverA,

Why should they all default to the same value? I have always been entirely in agreement with the first phrase of this famous quote. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Are you sure you have the most recent version of the UDF from the first page of the thread. :huh:

I checked this out this morning, and I did indeed still have the old version of the UDF. Thanks for the help :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

JLogan3o13,

Glad to hear it. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Melba,

johnmcloud,

Do you want to have a go? :huh:

If you do successfully modify it I will add a link to the first post. :)

M23

^_^

If you think i need to add other changes i'll do it, no problem for me...you have help me a lot of time so at least partially I'll try to reciprocate :D

Link to comment
Share on other sites

This may not be very helpful (or solicited) - but... I used this udf to create a commandline tool for some of my fellow employees. It allows them to provide a path, file type, and location for csv file - then it spits out size, date created/modified. It works as designed - thanks.

BUT... when searching very large file shares, with some folder paths that are very deep/long...more than 256 characters (that also happen to be cifs shares mounted on a novell server), I see that it chews up memory fairly rapidly, depending on file mask, while barely using any CPU. normally this wouldn't be a problem, but it doesn't end up paging to disk after memory runs out - so it will quit with a memory error before completing.

Any thoughts on chunking out when results hit a user defined limit, that way it can have a sort of garbage collection feature? Also, I can't see a programmatic way to increase performance - but it seems like it could use more CPU. I would expect bad code in a nasty loop to use up 12.5% of my cpu (8 cores) (like some code i've written... :/ ) - and/or something working really hard to use that much as well. This never breaks 2% cpu on my box, and takes hours to search the same share I could search using a dir /s command in 20 minutes or less.

Link to comment
Share on other sites

  • Moderators

z0iid,

I am not really prepared to work on the UDF to meet what seems to me to be a pretty specific requirement - sorry. But it was you who had a memory problem a while ago when running the UDF on shares - are you sure that you are not running into the same problem? I never did add that "no . and .." line into the release version - perhaps it might work again? :huh:

As to the time it takes - that is just the CPU share it a single AutoIt thread gets. Perhaps you could try using ProcessSetPriority to increase the CPU time the thread gets while this UDF is running. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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