Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enumerate files (with text in file)
#1
Is possible modify or add a function to do this?
#2
Use standard enumerating. Get file data. To find text, call find() or other string function...
#3
Thanks.

Is it the same algorithm that windows uses?
#4
Windows may use text indexing. QM calls API function FindFirstFile etc.
#5
Windows can search text in xls files and is faster, "Get file data" no...
#6
findstr.exe do it. Is possible implement in QM?
#7
Maybe. I have some old code that manipulates Windows Indexing Service through COM interfaces. Will post later.
#8
It probably was for WinXP. Does not work now on Win7.
#9
Quote:The findstr.exe command is an external command that is available in the below Microsoft operating systems.

Windows 2000
Windows ME
Windows XP
Windows Vista
Windows 7


do you know how it works?
#10
no
#11
Macro Windows Search SQL sample
Code:
Copy      Help
;Shows how to use Windows Search (WS) from QM, using SQL query.
;WS is a Windows component that is used to find files.
;For example, Windows uses it when you type in the search boxes in Start menu and Windows Explorer. You can access and change WS settings from there.
;It is in Vista/7. For XP can be downloaded from Microsoft.

;WS documentation: http://msdn.microsoft.com/en-us/library/ff628790%28v=VS.85%29.aspx
;WS SQL reference: http://msdn.microsoft.com/en-us/library/bb231256%28v=VS.85%29.aspx
;Shell properties (System.XXX) reference: http://msdn.microsoft.com/en-us/library/dd561977%28VS.85%29.aspx

;This code is converted from the 'WSFromScript' VBScript sample.
;Also there are other ways to use WS.

out
IDispatch objConnection objRecordSet

objConnection._create("ADODB.Connection")
objRecordSet._create("ADODB.Recordset")

;This is the Windows Search connection string to use
objConnection.Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';")

;SQL SELECT statement specifies what properties to return, you can add more if you want
;;;;;FROM - use SystemIndex for a local query or MACHINENAME.SystemIndex for remote
;;;;;WHERE - specify restrictions including SCOPE and other conditions that must be true

;This is a very simple query over the whole index. To add scope restriction append "WHERE SCOPE='file:c:/users'" to the query string.
objRecordSet.Open("SELECT TOP 10 System.ItemPathDisplay, System.ItemTypeText, System.Size FROM SystemIndex" objConnection) ;;display the first 10 indexed files; remove the 'TOP 10' to display all.
;objRecordSet.Open("SELECT System.ItemPathDisplay, System.ItemTypeText, System.Size FROM SystemIndex WHERE SCOPE='file:d:\downloads'" objConnection) ;;search single folder and its subfolders; to skip subfolders, use DIRECTORY instead of SCOPE.
;objRecordSet.Open("SELECT System.ItemPathDisplay, System.ItemTypeText, System.Size FROM SystemIndex WHERE CONTAINS('macro')" objConnection) ;;search all containing word "macro"
;objRecordSet.Open("SELECT System.ItemPathDisplay, System.ItemTypeText, System.Size FROM SystemIndex WHERE CONTAINS(System.Author,'G')" objConnection) ;;search all where author is "G"

objRecordSet.MoveFirst
rep
,if(objRecordSet.EOF) break
,;Access the column values that were specified in the SELECT statement here
,str s1 s2; int i
,s1=objRecordSet.Fields.Item("System.ItemPathDisplay")
,s2=objRecordSet.Fields.Item("System.ItemTypeText")
,i=objRecordSet.Fields.Item("System.Size"); err i=0
,out "'%s'  '%s'  '%i'" s1 s2 i
,objRecordSet.MoveNext
#12
Thanks, but what I'm looking for is to search within any file without indexing previously.
#13
I don't know other functions that would search in files of any format.
#14
I was hoping there was some API or function to do it

Function findstr_files
Code:
Copy      Help
function~ ~substring ~path

str fin
_s.format("findstr.exe /mis ''%s'' ''%s''" substring path)
RunConsole2(_s fin)
ret fin


Forum Jump:


Users browsing this thread: 1 Guest(s)