Nifty Box News

Tuesday, May 19, 2009

Spotlight Importer

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. )




Programmer's note:

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 [1]. 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.


[1] 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.

Labels: , , ,

Friday, August 01, 2008

Nifty Box 1.2

Nifty Box version 1.2 is ready for download!


This release adds AppleScript support to Nifty Box. Now you can access your Nifty Box tagging database through AppleScript or tag new items automatically. You can find some examples here.

Labels: ,

Thursday, May 15, 2008

AppleScript for Nifty Box

There is a new beta version of Nifty Box available for testing.

This version introduces AppleScript support for Nifty Box. Now you can tag files and web bookmarks automatically via AppleScript and much more. Just take a quick look at brief tour of the Nifty Box AppleScript interface!

If you are interested in testing the new beta version: download the beta from here.

Please bear in mind that this version is beta quality
!
So please make a backup copy of your Nifty Box database located in ~/Library/Application Support/Nifty Box/NiftyBoxDB.sqlite before running the beta version.

If you have any questions please do not hesitate to use the contact page.

Labels: ,