How can I create a spotlight importer for an OS X app that creates a spotlight tool like the calculator spotlight tool? It's the tool where you type in an equation and the calculator app displays the result. I want to do something like that, but I've never tried to use a spotlight importer so I don't know how I'd make that work. Is it possible to do this to begin with?
I don't need specific code, just a general idea of how I'd do that. I might even be thinking wrongly with taking an importer approach, but I'm not sure.
I'm pretty sure this isn't possible to do with a Spotlight importer, which is the only official interface for Spotlight integration that Apple provides.
A Spotlight importer runs only when Spotlight indexes your files (e.g. when a file of your type changes), not when Spotlight actually runs your search queries, so you have no way to directly "react" on the user's input like the built-in calculator does.
It might be possible to hack into the Spotlight UI with code injection, using something like SIMBL but that would be quite difficult and fragile (could break with system updates, etc.).