Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

utilise windows built in search functionality with wsh?

Posted on 2004-04-15
2
Medium Priority
?
160 Views
Last Modified: 2010-05-02
I would like to search inside a bunch of files on a cdrom with user specific search words from a multimedia app. either  using simply a vbs file or the scripting host activex control.

Can I open the windows search assistant [search:files and folders] from a .vbs file with the search options prefilled e.g.

search files/folders named: e.g *.doc *.txt *.xls
containing txt: user entered search terms
Look in: e.g. H:

start the search and display the results in either a file or just in the results window.
0
Comment
Question by:antonumia
2 Comments
 
LVL 17

Accepted Solution

by:
zzzzzooc earned 500 total points
ID: 10848665
You can open the "Find Files" window but I don't believe you'll be able to programmatically enter search criteria from VBS (could be wrong though).

Couldn't you just use the FSO though? Here's an example you'll have to convert. It should be mostly compatible.

Private Sub Form_Load()
    'Searches all folders within 'c:\windows\' and prints results to debug
    Call FindExt("c:\windows\", ".txt")
End Sub
Private Sub FindExt(ByVal sPath As String, ByVal sExts As String)
    Dim oFSO As Object, oFile As Object, oFolder As Object
    Dim oFiles As Object, oFolders As Object
    Dim sExt() As String, iLoop As Integer
    sExt = Split(sExts, ",")
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Set oFolder = oFSO.GetFolder(sPath)
    For Each oFile In oFolder.Files
        For iLoop = LBound(sExt) To UBound(sExt)
            If LCase(Right(oFile, Len(sExt(iLoop)))) = LCase(sExt(iLoop)) Then
                Debug.Print oFile
            End If
        Next iLoop
    Next oFile
    Set oFolders = oFolder.SubFolders
    For Each oFolder In oFolders
        Call FindExt(oFolder, sExts)
    Next oFolder
End Sub
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question