views:

69

answers:

1

If you search for something that opens Preview.app (e.g. a PDF file) in Spotlight, the application not only opens the file but actually copies the Spotlight query into the application's search field (for deeper search). iPhoto and Mail.app also do this.

This is a really nice feature. Unfortunately, Apple does not document how it's implemented. Opening a document from Spotlight appears to simply send application:openFile to the application delegate. Is it possible to retrieve the user's Spotlight query somehow? Or is this a hardcoded feature of Spotlight?

+1  A: 

If you're looking for the term used in the query, keyAESearchText will work (see listing 10-1). So yes, they document it, but not in the expected place. File an enhancement request at the bottom of the page.

Joshua Nozzi
Wonderful! I guess I was a bit quick in dismissing the docs, but I had been put off by an (admittedly old) blog post claiming it to be hard-coded. Thank you!
vicvicvic