Moderators Melba23 Posted August 3, 2019 Moderators Share Posted August 3, 2019 Hi all, I am using a ShellFolder object to get a listing of the content - as shown in this much shortened extract from the code: Local $oShellApplication = ObjCreate("Shell.Application") Local $oShellFolder = $oShellApplication.NameSpace($sPath) Local $oShellFolderItems = $oShellFolder.Items() Local $oShellFolderItemsFilterFlags = AsRequired $oShellFolderItems.Filter($oShellFolderItemsFilterFlags, "*") For $oShellFolderItem In $oShellFolderItems But although I can successfully use a single filter ("*.au3") to limit the returned items I am unable to find a way to set multiple filters for the returned items (such as "*.au3;*.a3x"). This is forcing me at present to get every item in the folder and then filter them in AutoIt code using a suitable RegEx, which obviously leads to a serious reduction in execution speed. Does anyone know of a way to use multiple filters when using .Filter to list the items so that I can avoid the AutoIt filter code? 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 Link to comment Share on other sites More sharing options...
Marc Posted August 3, 2019 Share Posted August 3, 2019 Seems to work for me: Local $oShellApplication = ObjCreate("Shell.Application") Local $oShellFolder = $oShellApplication.NameSpace(36) ; this is c:\windows. Local $oShellFolderItems = $oShellFolder.Items() Local $oShellFolderItemsFilterFlags = 64 $oShellFolderItems.Filter($oShellFolderItemsFilterFlags, "*.exe;*.log") For $oShellFolderItem In $oShellFolderItems ConsoleWrite ($oShellFolderItem.name & @CRLF) Next Lists all *.exe and *.log from my windows-dir. FrancescoDiMuro and Melba23 2 Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 3, 2019 Author Moderators Share Posted August 3, 2019 Marc, I though that I had tried all the sensible delimiters - but obviously not! Thanks a lot. 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 Link to comment Share on other sites More sharing options...
mikell Posted August 3, 2019 Share Posted August 3, 2019 3 hours ago, Melba23 said: I though that I had tried all the sensible delimiters Multiple filters must be separated by ";" , in : _FileListToArrayRec (Author ....: Melba23) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 3, 2019 Author Moderators Share Posted August 3, 2019 mikell, Go and look inside that function - all the filtering is done via Regexes in AutoIt code, so I could pick any delimiter I wanted. I thought I had tried semi-colons as a delimiter in the ShellFolder case too - along with commas, "|" and lots of others - but obviously I had not. My bad. 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 Link to comment Share on other sites More sharing options...
mikell Posted August 3, 2019 Share Posted August 3, 2019 Melba, Sorry. I was just joking a little, please don't care Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 3, 2019 Author Moderators Share Posted August 3, 2019 mikell, No probs. 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 Link to comment Share on other sites More sharing options...
Werty Posted August 3, 2019 Share Posted August 3, 2019 1 hour ago, mikell said: Melba, Sorry. I was just joking a little, please don't care We were many who wanted to joke, i mean, Melba actually starting a thread asking a question, unheard of Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Nine Posted August 3, 2019 Share Posted August 3, 2019 (edited) 2 hours ago, mikell said: I was just joking a little Really ? I thought you were seriously serious. Melba you should ban him ! Maybe someone may think I was serious too Edited August 3, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 4, 2019 Author Moderators Share Posted August 4, 2019 Werty & others, Never be afraid to joke - I enjoy a laugh as much as the rest of you, particularly when the joke is of my own making! M23 Exit 1 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 Link to comment Share on other sites More sharing options...
mikell Posted August 4, 2019 Share Posted August 4, 2019 13 hours ago, Nine said: Really ? I meant : I just found this forgetting from Melba so surrealist that I couldn't refrain - shame on me - and my post really didn't deserve any further explanation from him Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 5, 2019 Author Moderators Share Posted August 5, 2019 Hi again, This time I am looking for a way to exclude specified items from the return. Google is not being my friend at all - so any offers from you guys? 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 Link to comment Share on other sites More sharing options...
Nine Posted August 5, 2019 Share Posted August 5, 2019 (edited) @Melba23 try this : Local $oShellApplication = ObjCreate("Shell.Application") Local $oShellFolder = $oShellApplication.NameSpace("C:\Windows") Local $oShellFolderItems = $oShellFolder.Items() Local $oShellFolderItemsExcl = $oShellFolder.Items() $oShellFolderItems.Filter(0x40, "*") $oShellFolderItemsExcl.Filter(0x40, "*.exe;*.log") For $oShellFolderItem In $oShellFolderItems For $oShellFolderItemExcl in $oShellFolderItemsExcl If $oShellFolderItem.name = $oShellFolderItemExcl.name Then ContinueLoop 2 Next ConsoleWrite ($oShellFolderItem.name & @CRLF) Next Edited August 5, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted August 6, 2019 Share Posted August 6, 2019 (edited) @Melba23 This script seems to be a little bit faster: #include <StringConstants.au3> Global $hdlTimer = TimerInit() Global $oShellApplication = ObjCreate("Shell.Application") Global $oShellFolder = $oShellApplication.NameSpace("C:\Windows") Global $oShellFolderItems = $oShellFolder.Items() $oShellFolderItems.Filter(0x40, "*") For $oShellFolderItem In $oShellFolderItems If StringRegExp($oShellFolderItem.Name, '(?<!exe|log)$', $STR_REGEXPMATCH) Then ConsoleWrite($oShellFolderItem.Name & @CRLF) Next ConsoleWrite("Task completed in " & Round(TimerDiff($hdlTimer)/1000, 2) & " seconds." & @CRLF) Edited August 6, 2019 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Nine Posted August 6, 2019 Share Posted August 6, 2019 @FrancescoDiMuro That will not work if filter consists on multiple wild cards like a "?ind*,*" . You better let Windows manage it. FrancescoDiMuro 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Somerset Posted August 6, 2019 Share Posted August 6, 2019 http://www.googleguide.com/basic_operator_summary.html Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted August 6, 2019 Share Posted August 6, 2019 23 minutes ago, Nine said: That will not work if filter consists on multiple wild cards like a "?ind*,*" . All depends on how do you want to manage your filters... RE are quite flexibles to give the user what he/she needs. For example, the filter you proposed above could be easily translated in: .?ind.*,.* Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Nine Posted August 6, 2019 Share Posted August 6, 2019 Agree but you would need to modify your script for each filter. I don't think it is the way it should be done. You need to create a general RE for all possible filters. I believe it could be done, but why investing such an effort (risking some bugs) when Windows can do it for you, even if it costs a few more ms... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted August 6, 2019 Share Posted August 6, 2019 (edited) @Nine Why, you ask? For fun, obviousely Edited August 6, 2019 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Nine Posted August 6, 2019 Share Posted August 6, 2019 (edited) Have fun then... Edit : if you find a general RE solution, I would love to see it Edited August 6, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now