开发者

Contextual Menu Item development for OSX (Leopard and Snow Leopard)

开发者 https://www.devze.com 2022-12-17 17:06 出处:网络
i was wondering what the best practice is for creating a contextual menu item that would work in both leopard and snow leopard and works with a selection of files and/or folders, sending them to a she

i was wondering what the best practice is for creating a contextual menu item that would work in both leopard and snow leopard and works with a selection of files and/or folders, sending them to a shellscript.

i know that the contextual menu items have been deprecated in SL - but does that mean there is no way to create a solution that would work on both Leopard and Snow Leopard (using applescript or xcode or automator)?

basically i want to feed the files/folders to a shellscript that creates different 开发者_运维技巧compressed archives (rar, zip, tbz2) out of them.

thanks for your help!


There's not really a way to create one overall piece of code that will work in both Leopard and Snow Leopard.

You can, however, create a service for Snow Leopard and then create a Finder contextual menu for Leopard that just invokes that service.

That way you can do most of your implementation in Cocoa as part of the service, and only use the Finder contextual menu portion on systems that can't "natively" use the service.


Short of using an Automator service (10.4 or above) or the newly-overhauled services system (10.6 only), you'll have to leave the comfortable world of Cocoa:

SampleCMPlugIn


You can make an AppleScript application that accepts a drag 'n' dropped file/folder onto it.

You can probably make an Automator app to accept drag 'n' dropped files also.

Both should work on Leopard and Snow Leopard. On Snow Leopard, at least, you can set up a new Services Menu item that points to a particular app to process the selection. This is done via the Keyboard preference panel.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号