|Home » Learning Curve
That 'Unknown' Feature in OS X
It's been there all along. It's never been properly used.
ST ANDREWS (Rixstep) — Topher Kessler published an interesting piece at MacIssues yesterday. On 'How to quickly look up maps, movies, and more in OS X'.
What's amazing is that, after all these years, it still needs to be pointed out.
What's even more amazing is that this feature is simpler still - it's a feature largely ignored all these years. It's something inherited from the days of NeXT.
Apple inherited OS X from NeXT. One of the NeXT technologies was 'system services', aka 'Cocoa services'. All one needed to use this technology was to add a bit of gibberish to an application's Info.plist file (located in the Contents folder).
Something like this.
The above is a service for invoking searches at Amazon. The NSMessage and NSPortName are irrelevant here; the convoluted NSMenuItem key (with its sub-key) is merely the way a menu item is displayed (in this case as 'AWS Amazon'); the NSSendTypes key tells the system that character strings are what's offered. The key key is NSUserData. It is this key that makes it all possible - that represents the 'unknown feature' in OS X.
Look again at the character string for NSUserData in the example above.
It's a formula for a generic search at Amazon. And it ends with an equals sign ('=').
All you really need to do to search Amazon for something is to tack that 'something' onto the end of the above string.
Try it. Click the link below (which is exactly what it looks like).
The NSUserData field from NeXT (and later OS X) services didn't get much use, but it was fortuitous they put it in there.
And now it serves a great purpose - it makes any text, anywhere, searchable.
They can't do this on Linux; they can't do this on Windows either; only you can do it - on OS X.
Part of the reason this works so well is that NeXTSTEP came bundled with a comprehensive text system (called 'NSText') that even today is found in almost every nook and cranny of OS X. It's light years ahead of anything else on any other system.
All modern OS X applications use this text system. For example: because Safari uses it, double-clicking text anywhere on a web page can start you on your way to the search results of your choosing - a lot faster than anything else you can dream of.
Included on this page is a link to a free 'app' that will give you a dozen basic Cocoa services (for free). There are thousands upon thousands of such services already available, but it's best to dive in at the shallow end.
All you do is 'install' it - move it to its designated folder. It's fast, it's painless; full instructions are included.
The actual 'code' takes less than 14 KB - in fact, the icon is the larger component, almost three times as big as the code.
All the good stuff is found in the bundle's Info.plist.
It's yours. Everything is configurable. You can change the icon if you want. You can edit Info.plist if you dare. (There are free dedicated apps for this as well, but that's part of the graduate course.)
You enable and disable service items through your System Preferences.
Start with the README.html in the 40 KB download you get at the link below.
Download: 20150717,00.zip (24 KB)
Mac Developer Library: Services Properties
Mac Developer Library: Services Implementation Guide