as discussed here, this is vbscript that will accept also a regular expression input as part of the command line argument or manually assigned in
input box:
Option Explicit
Dim fso, oApp, oSource, strPath, strFilename
Dim oShell, oFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
Set oApp = CreateObject("Shell.Application")
If Wscript.Arguments.Count = 0 Then
Set oSource = oApp.BrowseForFolder(0, "Select folder to add", 22, 12)
strPath = oSource.Items().Item().Path
Else
strPath = Wscript.Arguments(0)
If Wscript.Arguments.Count = 2 Then
strFilename = Wscript.Arguments(1)
End If
End If
If strFilename = "" Then
strFilename = InputBox("Please type in filename incl. extension, e.g. 'folder.jpg' (supports regular expresson)","Browse folder","")
End If
If strPath <> "" And strFilename <> "" Then
Set oFile = fso.CreateTextFile("Result.m3u", True)
GetFolder strPath, strFilename
oFile.Close
oShell.Exec("%programfiles%\foobar2000\foobar2000 /command:" & chr(34) & "New Playlist" & chr(34) & " Result.m3u")
End If
Sub GetFolder(strFolder,strFilename)
Dim oFolder, oFolders, oFiles, item
Dim RegularExpressionObject, SearchSubstring, subitem, mark
Set oFolder = fso.GetFolder(strFolder)
Set oFolders = oFolder.SubFolders
Set RegularExpressionObject = New RegExp
With RegularExpressionObject
.Pattern = "(" & strFilename & ")"
.IgnoreCase = True
.Global = False
End With
For each item in oFolders
GetFolder item, strFilename
Set oFiles = item.Files
For Each subitem In oFiles
SearchSubstring = RegularExpressionObject.Test(subitem.Name)
If SearchSubstring Then
mark = 1
End If
Next
If Not mark = 1 And (oFiles.Count > 0) Then
oFile.WriteLine item.Path
End If
Next
Set RegularExpressionObject = nothing
End Sub
search code is different and because of reg exp possibility it's slower (i don't know if somebody will need it but there is other version in linked post).
it works reasonably but the main issue is that if you are searching for missing albumart it may put the whole artist folder in playlist (as it checks only if that folder is empty)
just to say: i'm not in vbscripting, just poking around - so don't expect too much
@ tedgo
i was thinking about the idea of searching for missing lyrics or something like that (search for associated files), and it's not so obvious:
i now where i keep my lyrics and how i name them, but you may have some very different scheme
or maybe you just want to search for some associated files
so the only thing that seems working to me is option with providing playlist:
for example, you'll must save playlist in m3u format (it could be all media playlist or playlist with items that are of your interest) and pass it to the script so it could search for missing files with custom extension according to the items in the playlist
i think that the only drawback in this case would be requirement for saving playlist (which could be done by the script) and not being able to process embedded files like in cue sheets
maybe even easier would be using the output from text tools component, but that is optional component
and maybe there are other options that i'm not aware of, so thoughts are welcomed