(1) Opens a message box, in which I type the string I want to search for; then
(2) Quickly shows a list of results.
But this only works if the characters in the string are sequential. I want to be able to narrow the search results by entering two different strings through a message box with two space to enter the two different strings.
For example, if I had a file called "Joe Smith - Letter from Acme Hardware.pdf"
I'd like to be able to enter "Smith" in the first space in the message box and "Acme" in the second space, and have it find the file even those two words are not next to the other in the file path name.
I wrote the script below which works by popping up 2 separate message boxes. But is there a way to revise the script so that it pops up a single message box which allows entry of two strings?
Code: Select all
#NoEnv
SetBatchLines, -1 ; affects CPU utilization... script will run at max speed
ListLines Off ; helps with speed
#SingleInstance Force
Gui, Add, ListBox, vListBox_ClList x16 y24 w1500 h1000
Gui, Show,, Test
Gui Font
Gui Add, Button, x1 y1 w75 h23 gOpenSesame, Open
BasePath1 := "C:\Users\PATH\DOWNLOADS\"
BasePath2 := "C:\Users\PATH\OneDRIVE\Documents\"
InputBox, Filter, Directory Filter, Filter?:,, 240, 130, 800, 1
InputBox, Filter1, Directory Filter, Filter1?:,, 240, 130, 800, 1
loop, Files, % BasePath "*.*", FDR
if InStr(A_LoopFileFullPath, Filter) & InStr(A_LoopFileFullPath, Filter1)
FileList .= A_LoopFileFullPath "|"
loop, Files, % BasePath2 "*.*", FDR
if InStr(A_LoopFileFullPath, Filter)
FileList .= A_LoopFileFullPath "|"
FileList := RTrim(FileList, "|")
Sort, FileList, D|
FileList := StrReplace(FileList, BasePath)
GuiControl,, ListBox_ClList, %FileList%
Gui, Show
return
OpenSesame:
GuiControlGet, Selection,, ListBox_ClList
Run, Explorer "%BasePath%%Selection%"
Gui , Hide
Return