Rixstep
 About | ACP | Buy | Industry Watch | Learning Curve | News | Products | Search | Substack
Home » Learning Curve

That 'Unknown' Feature in OS X

It's been there all along. It's never been properly used.


Get It

Try It

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.

NeXT Services

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.

<dict>
    <key>NSMenuItem</key>
    <dict>
        <key>default</key>
        <string>AWS Amazon</string>
    </dict>
    <key>NSMessage</key>
    <string>aws</string>
    <key>NSPortName</key>
    <string>AWS</string>
    <key>NSSendTypes</key>
    <array>
        <string>NSStringPboardType</string>
    </array>
    <key>NSUserData</key>
    <string>amazon.com/exec/obidos/search-handle-url/field-keywords=</string>
</dict>

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.

NSUserData

Look again at the character string for NSUserData in the example above.

amazon.com/exec/obidos/search-handle-url/field-keywords=

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

amazon.com/exec/obidos/search-handle-url/field-keywords=Apple Watch

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.

NSText

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.

A Taste

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.

Configurable

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.

See Also
Download: 20150717,00.zip (24 KB)

Mac Developer Library: Services Properties
Mac Developer Library: Services Implementation Guide

About | ACP | Buy | Industry Watch | Learning Curve | News | Products | Search | Substack
Copyright © Rixstep. All rights reserved.