Search code examples
objective-cmacosfindercontextmenu

How do I get information about the file/folder that has been right clicked BEFORE my OSX Service is displayed?


I am contemplating the creation of an OSX System Service as outlined here: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/SysServices/introduction.html My understanding is that I can add items to the Finder's right-click menu using this method.

The only big question mark in my mind is whether I can conditionally show my service NSMenuItem based on the item that is getting right-clicked. I don't see a way to do this in the docs, am I just missing something?


Solution

  • See here. You can’t run any code in advance, but you can use the NSSendFileTypes to specify an array of UTIs (which identify file types) that your service accepts.