Moderators Melba23 Posted June 12, 2011 Author Moderators Posted June 12, 2011 AZJIO, You need standard wildcard definitions, so you must use: '*.exe;*.msi;*.scr;*.dll;*.cpl;*.ax' M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
sleepydvdr Posted June 16, 2011 Posted June 16, 2011 Melba23, I just found your UDF and I like it. I like it so much, I want to make it part of my #include folder. However, you didn't offer a calltip, so I wrote one (I don't believe in just asking for everything handed to me, so I researched how to create one and insert it in Scite). If you want to improve upon it, please do so: _RecFileListToArray ("Path", "Include List", "Return", Recursion, Sort, Return Path, "Exclude List", "Exclude List Folder") Lists files and\or folders in specified path with optional recursion to defined level and result sorting (required: #include <_RecFileListToArray.au3> #include <ByteMe.au3>
JohnOne Posted June 17, 2011 Posted June 17, 2011 Melba23, I just found your UDF and I like it. I like it so much, I want to make it part of my #include folder. However, you didn't offer a calltip, so I wrote one (I don't believe in just asking for everything handed to me, so I researched how to create one and insert it in Scite). If you want to improve upon it, please do so: _RecFileListToArray ("Path", "Include List", "Return", Recursion, Sort, Return Path, "Exclude List", "Exclude List Folder") Lists files and\or folders in specified path with optional recursion to defined level and result sorting (required: #include <_RecFileListToArray.au3> Often wondered how you make them, but never looked into it. I thing just one parameter is needed though, so would it be _RecFileListToArray ("Path", "[Include List]", "[Return]", "[Recursion]", "[Sort]", "[Return Path]", "[Exclude List]", "[Exclude List Folder]") Lists files and\or folders in specified path with optional recursion to defined level and result sorting (required: #include <_RecFileListToArray.au3> AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
MvGulik Posted June 17, 2011 Posted June 17, 2011 Often wondered how you make them, but never looked into it.API file/line's I presume. ... Preferably automatically. (<funcName>'('<param text>')'[<funcRemark>]<NL>) "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ...
Moderators Melba23 Posted June 18, 2011 Author Moderators Posted June 18, 2011 JohnOne, This explains how to add user calltips and autocomplete in SciTE for UDFs. I use this calltip myself: ; _RecFileListToArray($sPath[, $sInclude_List = "*"[, $iReturn = 0[, $fRecur = 0[, $fSort = 0[, $sReturnPath = 1[, $sExclude_List = ""]]]]]]) Lists files and\or folders in a specified path with optional recursion and sort. (Requires: #include <RecFileListToArray.au3>) ; As to how it is done, there are a number of scripts on the forum which parse the headers of the UDF functions and add them to the correct files automatically. I wrote my own, but it is so tightly bound into my system that it is not a lot of use to anyone else without a lot of modification. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Moderators Melba23 Posted August 30, 2011 Author Moderators Posted August 30, 2011 (edited) AZJIO, 1. Multiple function call takes longerLonger than what? 2. Mask *.doc will include *.docxHave you tried? I add the \z end-of-string parameter to the mask SRE to make sure that it does not. M23 Edit: After looking at your code in more detail: - I see the speed difference between the 2 scripts, but the method you use to match files is not equivalent to that used in the UDF. As I mentioned above, I am using an SRE to look for a match - this enables you to have a far wider range of matches than that allowed by StringInStr. For example you can search for parts of the filename, not just an extension. - Since you seem keen on speed improvements, you might like to note that: StringInStr(FileGetAttrib($Path & '\' & $file), "D") is not needed since FileFindNextFile started returning @extended set to 1 if filename is a directory in v3.3.2.0 (Dec 2009) - it makes for a real saving in each pass through the loop. Edit: Editor screwing up text attributes when you try to edit a post! Surprise, surprise! Edited August 30, 2011 by Melba23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Moderators Melba23 Posted August 30, 2011 Author Moderators Posted August 30, 2011 AZJIO, As I have explained at length above, I wrote this UDF to meet my particular needs. As such it does exactly what I want - particularly in the sorting routine. I am well aware that there are faster ways to recursively list files but so far I have not found one which does precisely whatI require- so I wrote my own UDF. I am sure the script you linked to does exactly what you want - but it does not meet my requirements. You also appear not to have looked into the UDF code - nor indeed tried it very much. If you had done so, you would see that I do not run several file searches against the various different elements of $sInclude_List and $sExclude_List - I search once for all files on the path and then use SREs to match them against the masks generated from the Include/Exclude lists. And I am not at all happy that you post incorrect information such as "Mask *.doc will include *.docx" when a simple test shows it does not. In short, if you have specific comments on the UDF that you would like me to look into, please let me know what they are and I will do so - I am more than happy to consider amending the code as long as it still meets my needs. But please refrain from simplistic, non-constructive criticism such as you have been posting - if you want to do it another way, then do so and post your own UDF (as I know you already have here). M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Moderators Melba23 Posted August 30, 2011 Author Moderators Posted August 30, 2011 All, Please note that I am not talking to myself here - AZJIO has deleted the posts made earlier today to which I was replying. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
BrewManNH Posted August 30, 2011 Posted August 30, 2011 All, Please note that I am not talking to myself here - AZJIO has deleted the posts made earlier today to which I was replying. M23Luckily I'm sure most of us saw the posts that were here before, so you can rest easy that most of us don't think you're overly batty. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Moderators Melba23 Posted August 30, 2011 Author Moderators Posted August 30, 2011 BrewManNH, overly battyJust lightly touched, eh! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
akurakkauaaa Posted August 30, 2011 Posted August 30, 2011 my version my crap: myFileListToArray_AllFiles, SciTE Helper, myImageSearch
AZJIO Posted August 31, 2011 Posted August 31, 2011 And I am not at all happy that you post incorrect information such as "Mask *.doc will include *.docx" when a simple test shows it does not. Removed a post that gave false information. Random coincidence of circumstances, initially could not use the mask. Conclusions made on the basis of AutoIt.chm. My other projects or all
TopXm Posted October 11, 2011 Posted October 11, 2011 Hello Sorry for my poor english ... I want to use _RecFileListToArray() but some problems arise expandcollapse popup#include <RecFileListToArray.au3> #include <array.au3> Local Const $DirGlob = "C:\Test" Local Const $SubDir1 = "C:\Test\Bob1" Local Const $SubDir2 = "C:\Test\Bob1\plop" Local Const $SubDir3 = "C:\Test\Bob1\plop1" Local Const $FileName = "MyFile.Txt" Local $I, $nFile ; I create some folders to test UDF For $I = 0 to 15 If Not FileExists($DirGlob & "\Bob" & $I) Then DirCreate($DirGlob & "\Bob" & $I) Next ;I create subfolders who contain a text file i want to retreive If Not FileExists($SubDir1) Then DirCreate($SubDir1) If Not FileExists($SubDir2) Then DirCreate($SubDir2) If Not FileExists($SubDir3) Then DirCreate($SubDir3) ;I create the same file in the tree subfolders $nFile = FileOpen($SubDir1 & "\" & $FileName, 2) FileClose($nFile) $nFile = FileOpen($SubDir2 & "\" & $FileName, 2) FileClose($nFile) $nFile = FileOpen($SubDir3 & "\" & $FileName, 2) FileClose($nFile) ; 1/ MyFile.Txt in Bob1 and subfolders (Recursive + NoOrder + RelativePath) (OK it's good) Local $Array1 = _RecFileListToArray($SubDir1, $FileName, 1, 1, 0, 1) If IsArray($Array1) Then _ArrayDisplay($Array1, "Array1") ; 2/ I want to find MyFile.Txt in C:\Test ; I want to retreive the folder's Name where MyFile.txt exists (Recursive + NoOrder + FullPath) Local $Array2 = _RecFileListToArray($DirGlob, $FileName, 2, 1, 0, 1) if IsArray($Array2) Then _ArrayDisplay($Array2, "Array2") ; 3/ I want to find MyFile.Txt in C:\Test (Recursive + NoOrder + FullPath) ; I retriver all Folders and Files ! Local $Array3 = _RecFileListToArray($DirGlob, $FileName, 0, 1, 0, 1) if IsArray($Array3) Then _ArrayDisplay($Array3, "Array3") ; I delete test environment DirRemove($DirGlob, 1) My questions :For the The third search, why i receive all folders and files when filter is "MyFile.txt" ?If i replace "MyFile.txt" by "*.txt" the results are not the sames ?Last question, if y want to retreive all foldernames of a specific file, how can it be done?Thank's
Massi Posted October 12, 2011 Posted October 12, 2011 (edited) Hi all, my first post. Sorry for my english. I like this UDF and I will try also the others projects suggested in this topic for sure. Maybe I've found a bug in this UDF or I misunderstand how to use in the proper way _RecFileListToArray My purpose is to find the folder where a file is placed (I know the file name). The function works well but I have an error if the name of file to search contains bracket [ Please try to create a file C:\Test\Nuovo Documento di [testo.txt and test the code below. Try again modifing the code and the name of txt with Nuovo Documento di testo.txt (without the bracket). Please let me know if I'm wrong using this function. #include "RecFileListToArray.au3" Dim $aFile,$FileName,$Test="C:\Test\" $FileName="Nuovo Documento di [testo.txt" $aFile=_RecFileListToArray($Test,$FileName, 1,1,0,1,"","") If @error=1 Then MsgBox(0,"Error","@Error:"&@error&@CR&"@Extended:"&@extended) Else MsgBox(0,"OK",$aFile[1]) EndIf Edited October 12, 2011 by Massi
AZJIO Posted October 12, 2011 Posted October 12, 2011 Melba23 $sList = StringReplace(StringReplace(StringRegExpReplace($sList, "[][$^.{}()+]", "\\$0"), "?", "."), "*", ".*?") My other projects or all
Spiff59 Posted October 13, 2011 Posted October 13, 2011 (edited) I'm seeing some other recursive versions of FLTA also aren't handling certain special characters in filenames. Your SREP mod works for me with the exception that I needed to escape the square brackets: "[\]\[$^.{}()+]" Edit: Hmm, I didn't stick the brackets at the very front of the list of chars. I now tried your order and it's working without the slashes... odd. working with regular expressions is a great way for me to get confused (even though this is as basic as SRE gets), but it appears that order makes a difference... Edited October 13, 2011 by Spiff59
Moderators Melba23 Posted October 13, 2011 Author Moderators Posted October 13, 2011 Sorry for the delay in replying - I have been away for a few days on a very interesting course. TopXm, For the The third search, why i receive all folders and files when filter is "MyFile.txt" ?Because that is what the UDF does if you set $iReturn to 0 and $iRecur to something other than 0. Look at the first post and the filter logic: $iRecur <> 0 and $iReturn = 0 (Files + Folders) Searches and returns all folders unless explicitly excluded Please remember that (as I explained a few posts above): "I wrote this UDF to meet my particular needs" and that is what I wanted it to do. If you just want the files then set $iReturn to 1 and all you get returned is the files. If i replace "MyFile.txt" by "*.txt" the results are not the sames ?They are the same for me - can you explain what results you get? if y want to retreive all foldernames of a specific file, how can it be done?I would do this: Local $Array3 = _RecFileListToArray($DirGlob, $FileName, 1, 1, 0, 1) For $i = 1 To $Array3[0] $Array3[$i] = StringReplace($Array3[$i], "\" & $FileName, "") Next _ArrayDisplay($Array3, "Array3") which will return the folders containing that file. Is that what you want? Massi, AZJIO has it right - the UDF needs to escape the [ ] characters. AZJIO, Your suggested SRE looks pretty good at first glance - I will release a new version this weekend once I have tested it fully. Spiff59, I do not believe you need to escape the [ ] characters - from the Help file: To include a closing bracket in a set, use it as the first character of the set. e.g. [][] will match either [ or ] Similarly, the ^ does not need escaping: To include a caret (^) in a set, put it after the beginning of the set AZJIO's SRE works fine for me. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Spiff59 Posted October 13, 2011 Posted October 13, 2011 (edited) Spiff59, I do not believe you need to escape the [ ] characters - from the Help file: To include a closing bracket in a set, use it as the first character of the set. e.g. [][] will match either [ or ] Similarly, the ^ does not need escaping: To include a caret (^) in a set, put it after the beginning of the set AZJIO's SRE works fine for me. M23 Ah... the help file ... THAT thing Edit: no sheepish grin or embarassed emoticon? I guees Doh! is the best I can do. It seems to be finding a file named ""Nuovo Documento di ([{te^sto+]}).txt" now, so the added special chars seems to be working with the modded SREP. Edited October 13, 2011 by Spiff59
Recommended Posts