Everywhere I look I see that writing a Finder Plugin in Snow Leopard is much easier than it was in Leopard. Can someone point me to some tutorial or simple code example I can download?
I am trying to write a customer right-click menu item for Finder开发者_StackOverflow.
There is no official or supported plugin system for the Finder. Starting with OS X 10.6, you will need to inject code into the Finder process and override objective C methods in the Finder process.
I've done this for a proprietary project. I can tell you that the reason that there are no examples or tutorials for this is because it is a significantly difficult and time consuming development task. For this reason, there's plenty of incentive for individuals or organizations who have accomplished this to guard the specifics of their process closely.
If there's any way at all that you can accomplish your goal using the Services API, do it. Writing a Finder plugin will take you 1-2 solid months of painstaking development and reasonably deep knowledge of C and Objective-C internals.
If you're still convinced that you want do to this, grab mach_star. Good luck.
If by plug-in you mean contextual menu, you can do this via the services API.
Hope this helps.
PK
Apple now requires that you write a Service instead of a Finder plug-in. That's why you're finding it so much more difficult now than before. In fact, context menu plug-in support has been removed from 64-bit applications (which the Finder is now by default). Even if the context menu plug-in is 64-bit, the application will not load it. However, enhanced services show up as context menu items, so this should allow you to implement the same feature set that you're looking for.
See the answers to this question for more on how to write Services in Snow Leopard.
Dropbox and Safesync have a Finder plugin for displaying contextual menues and overlay icons. I am not sure how Dropbox did, but for Safesync, you can find a bundle located in /Library/Application Support/SIMBL/Plugins. So SIMBL may helps.
This question has been around for awhile, but I know people are still looking so here's a completed solution for Finder icon badges and contextual menus in Lion and Mountain Lion using method swizzling.
Liferay Nativity provides a scripting bundle that will swizzle the relevant Finder methods and a Java client for setting the icons and context menus. It also includes equivalent projects for Windows and Linux.
Hopefully this will save you the 1-2 solid months of painstaking development described by anthony. :)
The project is open source under LGPL, so feel free to contribute any bug fixes or improvements!
精彩评论