-
April 20th, 2014, 10:48 PM
#1
Searching documents for a string using IFilter?
Hi all,
I am trying to create a program that can search for a string in all MSOFFICE documents.
I originally tried to do this with VB Script as follows:
Code:
dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objShell
set objShell = CreateObject("WScript.Shell")
x=msgbox("Word Search Started",0,"Word Check")
strSearchFor = InputBox("Please enter a string to search for:")
Set oFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = InputBox("Please enter a folder to search in:")
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
strFile = "C:\Test1\" & objFile.Name
set objFile = objFSO.getFile(strFile)
if objFile.size > 0 then
If InStr(oFSO.OpenTextFile(strFile).ReadAll, strSearchFor) > 0 Then
x=msgbox("Word Found!",16,"Word Check")
Wscript.Echo strFile
Else
WScript.Sleep (100)
END If
END If
Next
But after some research I found that this wasn't possible due to the file types (If it is please let me know).
After a little more research I think IFilter may be the way to go seeing as though it is used for the Windows Search function. If possible could I be provided some sample C# just to show how to parse any MSOFFICE file and search for a string.
I'm probably asking too much but as I'm sure you can tell still new to this
Thanks for any help you can provide.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|