OpenFolderThatHas filename
Opens every folder on the drive the script is run from, that contains a file filename. May use wildcards like *.cmd or *.txt. It only accepts one argument. filename
It opens the folder and waits until the window is closed to do the next Loop.
Edit: prompts for filename if none on command line. Enter just a filename, no drive or path (e.g. readme.txt)
if 0 < 1
{
InputBox,filename,,Enter File Name with no path
if (ErrorLevel)
ExitApp
}
else
filename = %1%
tmp := A_ScriptDir
StringLeft,drive,tmp,3
FilePat := drive filename
Loop, %FilePat%,,1
{
tmp := _FileDir(A_LoopFileLongPath)
;MsgBox, 8256, Test, %A_LoopFileLongPath%`n%tmp%
Run,%tmp%
WinWaitActive,%tmp%,,5
if (ErrorLevel)
continue
while WinExist(tmp)
{
Sleep,250
}
}
_FileDir(path)
{
SplitPath,path,,fdir
return fdir
}
edit: I removed the "#notrayicon" so it can be killed via tray icon to break the loop. Also note that it waits until a window with the title that matches the folder name no longer exists. If you happen to have the same folder already open, it will hang. So close all explorer windows before running, or fix the script.