Jump to content

Recommended Posts

Posted
2 hours ago, Nine said:

Edit : if you find a general RE solution, I would love to see it :)

There is no general RE solution.

We are talking about filters, so every pattern must be build based on what has to be excluded or included, isn't it? :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Posted
7 minutes ago, FrancescoDiMuro said:

We are talking about filters, so every pattern must be build based on what has to be excluded or included, isn't it?

I think it is doable to have a general RE.  There is only 2 wild cards ? and *.  I believe someone agile with RE could make a first pass to replace DOS filter into a RE pattern then use it in a StringRexExp like you did...But that someone is not me :)

  • Moderators
Posted

Hi,

Thanks for the replies, but using a RegEx on all the returns is exactly what I am trying to avoid. As I explained to mikell earlier, if you look inside _RecFileListToArray you will see that the function changes the DOS wildcard inclusion/exclusion lists into SRE format within the following function:

Func __FLTAR_ListToMask(ByRef $sMask, $sList)
    ; Check for invalid characters within list
    If StringRegExp($sList, "\\|/|:|\<|\>|\|") Then Return 0
    ; Strip WS and insert | for ;
    $sList = StringReplace(StringStripWS(StringRegExpReplace($sList, "\s*;\s*", ";"), BitOR($STR_STRIPLEADING, $STR_STRIPTRAILING)), ";", "|")
    ; Convert to SRE pattern
    $sList = StringReplace(StringReplace(StringRegExpReplace($sList, "[][$^.{}()+\-]", "\\$0"), "?", "."), "*", ".*?")
    ; Add prefix and suffix
    $sMask = "(?i)^(" & $sList & ")\z"
    Return 1
EndFunc   ;==>__FLTAR_ListToMask

And then each returned element is checked to see if it should be listed with lines such as this one:

If $iReturn <> 2 And StringRegExp($sName, $sInclude_File_Mask) And Not StringRegExp($sName, $sExclude_File_Mask) Then

This works perfectly, but it means using AutoIt code to loop through each item and run more than one SRE on it to check if it a valid item - which is not fast! As I explained in the first post I am trying to bypass this bottleneck in execution speed and get Windows to do all the work for me. Hence my initial wish to have multiple include filters - the solution to which caused everyone (including me) so much amusement.

Now I am hoping there is some way to get Windows to exclude files when using .Filter on the item list - but I have found nothing when Googling and was hoping that someone here already had an answer. So many thanks for your efforts so far but they really do nothing more than my existing code in _RecFileListToArray - what I want is an internal Windows filter so that all I see is the already filtered list within .Items.

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

 

Posted

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
  • Recently Browsing   0 members

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