Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Search Find String Text Leading Trailing Whitespace Space Binary BinaryAlloc BinaryIndexEx
Development of the File Search Extender (WSRCH34I.DLL) is currently suspended. There has been talk about deprecating the the File Search Extender (WSRCH34I.DLL) all together. It's main functionality has been replaced by the File and Folder Finder Extender (WWFAF44I.DLL). However the File and Folder Finder does not support searching for text inside of files. You would need to add code to query each file located by the File and Folder Finder by using Binary operations. Here is an example theat uses the File and Folder Finder Extender and Binary operation to search for text in a file.
Note this technique resolves the leading a trailing space issue:
;Load Appropriate Extender If WinMetrics(-2) == 3 Then AddExtender("WWFAF64I.DLL") ; 64-bit Else AddExtender("WWFAF44I.DLL") ; 32-bit searchstring = 'Read ' ; Initialize flags for readability fsHidden = 1 ; Include hidden files fsSystem = 2 ; Include system files fsRecurse = 16 ; Look in sub directories ; Open a search handle fsHandle = fafOpen(DirScript(), "*.txt", fsHidden|fsSystem|fsRecurse) filelist = '' While 1 sFoundFile = fafFind(fsHandle) If sFoundFile == "" Then Break ; Search File For Text handle = BinaryAlloc( FileSize(sFoundFile) ) BinaryRead( handle, sFoundFile ) ptr = BinaryIndexEx( handle, 0, searchstring, @FWDSCAN, 1 ) If ptr !=-1 Then filelist = ItemInsert (sFoundFile, -1, filelist, @LF) BinaryFree(handle) EndWhile If filelist == "" Pause ('Search result', ' No Files Found') Else Pause ('Search result', filelist) EndIf fafClose(fsHandle) Exit
Article ID: W17568
Filename: Search String With Whitepace.txt
File Created: 2012:05:10:13:10:08
Last Updated: 2012:05:10:13:10:08