Heureka... I did it
Hi all...
After having hours of fun coding I came out with a pretty neat solution imho.
What I did:
I started with those alternate data streams (ADS) mentioned above (thanks) and looked and tested around a while and those seemed after all drawbacks well suitable for adding tiny bits of information to a file. Also because the info stays there when you move, copy or rename the file (even over network). So basicly I need this functionality then:
1. Create/Update custom ADS
2. Search for custom ADS content and present a result
As soon as I realized VBScript

is able to read and create ADS files point 1 was no big thing. I created two scripts: SetADS and ViewADS. Using them like this:
wscript SetADS.vbs Comment myFile.txt
I can create/update the ADS named Comment on myFile.txt. (ViewADS works the same, but only show the ADS content). Yes, multiple ADS are possible, just replace Comment with Tags for example (only one word and legal file name characters only allowed for a stream name)
For Point 2 the script called FindADS is the bigger problem. First I need to find all finds with a Comment ADS (for example), but easiely done via recursive search an a folder:
wscript FindADS.vbs Comment c:\data
But then how to show the results? It would have liked to integrate it as search connector at the normal search dialoge, but as far as I see it right, only webpages can be used. What other possibilities? Well as those should nicely integrate with Windows7, gadgets may would work but how to open the results? I little application to dock at superbar with a jump list that supports search? Multiple ways, but...
I dicided to go for a Library in the end. Why? Well, I can present a collection of shortcuts without opening an exploror at the real physical folder. As the library stays at your explorer main view you never need to remember a previous search folder. And the library shows the number of matches at the top instead in the statusbar only and you have title displaying for search keywords. Plus it's up to you when you remove or update the library. So search once, work as long as need the result and remove it afterwards. No need to browse anywhere in explorer. I must admit though I also looked at the Searches folder. Those search connectors are XML files also but I wanted to make the scripts work first and started out with libraries already. Maybe this can be changed later if desired.
Okay, how could this be done? It turns out, a library is just a little XML file with special file extension I can write myself. And a library can be opened in explorer via cmd call and thus also by VBScript. So basicly the script does following:
- Ask user for search keywords
- Recursive seach for ADS and make a in string search against content and file path
- Create a result folder and create shortcuts for every file found
- Create a library and point to this folder
- Open the library in a new explorer window
So the search works even when your keyword is found in the path of a file in your search path or any subpath. I just assume you sort you're files anyway
Okay, want to try (I hope it works for you...)? Let's go:
First you need the following scripts I packed up here (WinRar):
http://dl.getdropbox.com/u/473379/Releases/VBscript/ADS Set&Find Win7/ADS Set&Find Win7.rar
Expand and drop it somewhere where the scripts are meant to stay (I reference this path as <InstallDir> from now on)
Next is to make the scripts usable. I'll show you my way: to include shortcuts in the SendTo folder (Mine is at: C:\Users\GHad\AppData\Roaming\Microsoft\Windows\SendTo).
Create shortcuts for all three scripts by right dragging them to the SendTo folder and selecting create shortcuts. Now rename and change each shortcuts properties and decide for a stream name, I use Tags for example:
- Rename Shortcut to FindADS.vbs to Find Tags
- Change properties target to: C:\Windows\System32\wscript.exe "<InstallDir>\FindADS.vbs" Tags
- Rename Shortcut to SetADS.vbs to Set Tags
- Change properties target to: C:\Windows\System32\wscript.exe "<InstallDir>\SetADS.vbs" Tags
- Rename Shortcut to ViewADS.vbs to View Tags
- Change properties target to: C:\Windows\System32\wscript.exe "<InstallDir>\ViewADS.vbs" Tags
Allright. From now on I can right click on any file and select Send to... Set Tags to input my tags. I can right click on any folder and select Send to... Find Tags, input my search and hit enter. The search pops up when done.
If there's interest in doing more for integration or any improvment, I'm willing to turn this into open source with help of some more expirienced people. Just send me a message. I would also like to get feedback about if it works for you. Thanks.
The folling issues/drawbacks are still to resolve for my solution:
- No deletion of ADS
- No deletion of created libraries
- No deletion of find result folders
- Only legal file name characters allowed as ADS content
Well, empty ADS consume 0 bytes, libraries can be deleted by user and the find result folders contain only shortcuts, so they won't comsume that much space. For the same search the same output folder will be used so this shouldn't go too big. And for the last glitch. This is only because the content is added to the shortcut name at the result, so an illegal character will mess up the shortcut filename. This can be turned of by editing the VBS script though, but I thought this is a only little mess for a big benifit.
Hope you like the solution, have fun, greetz,
GHad
PS: No warranty at all, see ScriptHeader for license and details