Tim
Mon Jun 18 10:51:35 CDT 2007
Hi Sergio,
I'm not familiar with OCR process (or with MSPVIEW), but I found the
command line parameters for MSPVIEW here:
http://office.microsoft.com/en-us/help/HP030832691033.aspx
I'm guessing that the -f parmeter is what you want. Check out the
script below, it will OCR any .tif file within sPathToInputFolder or
within any of sPathToInputFolder's
subfolders. Once you are confident it is
doing what you want, comment out the MsgBox lines so that you don't
have to press 'OK' for every file.
Tim.
Option Explicit
Dim sPathToMSPView
Dim sPathToInputFolder
Dim oFSO
Dim oFolder
Dim oFile
Dim oShell
'CONFIGURE THESE*****************
sPathToMSPView = "C:\Program Files\Common Files\Microsoft Shared
\MSPaper\mspview.exe"
sPathToInputFolder = "C:\Test"
'********************************
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sPathToInputFolder)
Set oShell = CreateObject("WScript.Shell")
'call our function to OCR all files in the InputFolder
'the function will call itself for each subfolder (and each of thier
subfolders etc)
OCRAllFilesInFolder oFolder
MsgBox "Finished"
Public Sub OCRAllFilesInFolder(oFolder)
Dim oSubFolder
Dim sCommand
For Each oFile In oFolder.Files
'only do this for .tif files
If UCase(Right(oFile.Path,4)) = ".TIF" Then
sCommand = """" & sPathToMSPView & """ -f """ & oFile.Path &
""""
MsgBox "About to OCR " & oFile.Path & " using the command:" &
vbCrLf & sCommand
oShell.Run sCommand, 1, True 'Use 1 to run in Normal window, 0
to run invisible etc, etc. Use True to make this script wait for the
command to finish
Else
MsgBox oFile.Path & " is not a .tif file, skipping it..."
End If
Next 'oFile
'Now call for each of this folders SubFolders
For Each oSubFolder In oFolder.SubFolders
OCRAllFilesInFolder oSubFolder
Next
End Sub