Skitty Posted February 22, 2011 Share Posted February 22, 2011 I want to make this function match a name of a file or directory by using an abbreviation instead of the full file name. eg, Expl,Not would match Explorer.exe,Notepad.exeScanFolder(@WindowsDir,"Explorer.exe,Notepad.exe") Func ScanFolder($SourceFolder, $46) Local $Search Local $File Local $FileAttributes Local $FullFilePath Local $FileCount = 0 $Search = FileFindFirstFile($SourceFolder & "\*.*") If $Search = -1 Then Return While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop If @extended Then ScanFolder($SourceFolder & "\" & $File, $46) Else $460 = StringSplit($SourceFolder & "\" & $File, "\") $461 = UBound($460) - 1 ;ToolTip($SourceFolder & "\" & $File, 0, 0) If StringInStr($46, $460[$461]) Then MsgBox(0, "Done", "MATCH!! " & $SourceFolder & "\" & $File) EndIf EndIf WEnd FileClose($Search) EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 22, 2011 Moderators Share Posted February 22, 2011 System238,Take a look at the RecFileListToArray UDF in my sig. It uses SREs to match partial names and should give you a good pointer on how to proceed. The _RFLTA_ListToMask function shows how to convert your "Expl*.*;Not*.*" text to an SRE pattern and you can easily spot the StringRegExp lines where the comparison is made as FileFindNextFile produces a new name. Come back if you need more help. 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...
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