Jump to content

"Windows Search" automation by COM?


orbs
 Share

Recommended Posts

problem:

DOS find & findstr are useless for non-text files (like MS Office files, etc.), and unreliable when it comes to non-English characters. this seems to be the case also in PowerShell (Select-String cmdlet).

now, "Windows Search" handles it all very well, even without the indexing service.

 

even greater problem:

the term "Windows Search" is not search-friendly... you get every result in the web, except anything related to "Windows Search".

 
solution?

so, how scary is it to try and control "Windows Search" by COM? Microsoft has an SDK for it. but i'm not that much of an expert.

note:

if it's any easier, using the index is not a must. actually i prefer to ignore the index, because the search location is likely to not be indexed.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Can you provide a link to the MS SDK for Windows Search?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Can you provide a link to the MS SDK for Windows Search?

 

http://www.microsoft.com/en-us/download/details.aspx?id=7388

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

I'm not sure but it look like MS only supports managed code. If you find an example for Visual Basic then it should be easy to convert to AutoIt.

I haven't been lucky so far.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

$oShell = ObjCreate("shell.application")
$oShell.FindFiles
... but what should we do next?

 

 

that is equivalent to

Send('#f')

which is not what we are looking for. although the GUI can be automated, but that is not robust, and will not work for scheduled tasks, server scripting, remote calls, or anything that has no GUI.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

I'm not sure but it look like MS only supports managed code. If you find an example for Visual Basic then it should be easy to convert to AutoIt.

I haven't been lucky so far.

 

i did not find VB examples too, as far as i understand, Windows Search programming is .NET based.

maybe this will be helpful: http://msdn.microsoft.com/en-us/library/bb266516%28VS.85%29.aspx

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

i took an extremely long shot in the direction of reading the contents of the files and trying to get a notion on how Windows Search is reading the text in files, to see if this can be done by AutoIt.

.

i took as examples, the new Office XML format (2007+) and the old compound format (97-2003).

for the compound file, you can ignore the structure and extract the text as unicode, but the results will include text from all fields, not just the main text of the document.

the XML is actually a zip file, containing simple text files in XML structure. ref:

http://www.forensicswiki.org/wiki/Word_Document_(DOCX)

so it's quite simple for AutoIt to unzip and search, but that will be slow, and the results will be much much more than the text.

and that's just two examples, there are many more file types, with different structure and formats. but Windows Search seems capable of dealing with any file, regardless of type.

it does not seem logical (to me) that it simply have a huge set of algorithms, from which it can select the appropriate one for any file it encounters depending of the file type. that would mean that (ideally) Windows Search is aware of all existing file structures and formats,

the other option is some kind of a generic algorithm (or a few of them) that gives good enough results for whatever file it encounters.

this was a bit of under-the-hood research, but now, closing the hood and trying to start the engine, i see that the only code examples that are available (on the web and in the SDK) are only handling the index db, not the search function. i did not encounter any example, any language, that instructs Windows Search to go and search a location.

but that must exist, right?

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...