06-05-2012, 12:10 AM
When I try to get text from multiple files in the file path, the program executes normally and retrieves text from all of the files. However, after retrieving the text from the last file, I get the following RT error: Error (RT) in DocSearchTest: 0x800401EA, Moniker cannot open file. ?
typelib Word {00020905-0000-0000-C000-000000000046} 8.0
str files
if(!inp(files "Please specify the location of the files:" "TestDocRetrieve" "C:\test\*.doc")) ret
Dir d1
foreach(d1 files FE_Dir) ;;for each file that matches the pattern.
(`i),str sPath=d1.FileName(1)
,Word.Document d._getfile(_s.expandpath(sPath))
,Word.Range r
;get all text
,r=d.Range
,lpstr sAllText=r.Text
;;out sAllText