Many people asked for an easy way to automatically import files into Nifty Box by using their Spotlight comments. I have created a small tool that will do just that:
First you choose a folder to import from (the original files wont be moved. Only aliases will be added to Nifty Box that will link to them). Here you can specify if subfolders will be imported too.
As a second step you can specify a tag prefix ("&" or "@") or leave it blank ("none"). If a tag prefix is specified, only tags will be imported having this prefix.
After clicking "Start Import" the importer will scan the Spotlight comments of all files in the given folder (and its subfolders if specified). If it finds relevant tags (taking into account the optional tag prefix) the tool will import the files into Nifty Box and set the tags in Nifty Box accordingly.
During the operation log messages are written to the text window at the bottom of the importer.
download Nifty Box Spotlight Importer now
(Note: This tool only works on Leopard. )
The importer is a cocoa application. But the cocoa "application" is just a wrapper for a python script that itself is just a wrapper for a couple of applescript functions. I've chosen to do it in such a rather odd way, because I had to use applescript as it can talk to Nifty Box and the Finder.
But applescript is rather a mess to deal with . So for all the infrastructure I've used python. (I know, I could have taken the "appscript" module from python and get rid of all the applescript stuff, but that would have been just half the fun...)
If you like, take a look at the python source file. It contains a very, very basic python-to-applescript value converter (for strings and lists).
Included is a small replacement for the split() method of the string class, which can handle quotation marks.
If you have for example a string like:
a = 'aa "bb cc"'The standard split function would yield:
a.split() -> ['aa', '"bb', 'cc"']The function words() parses the quoted string as a single entity:
words(a) -> ['aa', 'bb cc']
The module is released as open source under the BSD license, so feel free to copy, rip apart, whatever.
 As Joshua Hart tweeted: "AppleScript is easy to read but difficult to write. I call it the Anti-Perl." This sums up my experiences pretty well.