I need to add a context-sensitive menu to file icons in the finder. So basically if I right click, say, the "filename.txt" icon, a submenu should pop up with "Open", "Get Info", etc but there should be an additional item that says, say, "My Program". And if user selects the "My Program" menu selection, the system will execute: "my_program.rb filename.txt".
I have Mac OS 10.6 32-bit.
I checked stack overflow and I there are posted solutions, but am a bit confused by them. Firstly, according to this stack overflow article, you have to "add a Service that enables the share facility", but this is confusing to me. What is a "service"? Is that a program with special hooks to the OS or something?
There is also an apple article for "providing a service" but again, I am a bit confused by it. Can a ruby script count as a "service"? Or do I have to do some weird Cocoa thing in objective C to access the submenu and then refer to the script in there?
Is there a simpler way to do this? Maybe an open source program that I haven't yet encountered?
Install New File Menu and enable it as a Finder extension. To do so, open the Settings app, go to Extensions and enable it. What is this? Right-click inside a Finder window and you will see options to create a new text file, a new RTF document, a new Pages document, etc.
Control-click on a Mac is similar to right-click on a Windows computer—it's how you open shortcut (or contextual) menus on a Mac. Control-click: Press and hold the Control key while you click an item. For example, Control-click an icon, a window, the toolbar, the desktop, or another item.
The context menu appears when you Control+click, right+click, or two-finger click something on a Mac. Most of the items in a context menu appear depending on what was clicked and which app you are using.
You should use services.Take a look at Services Implementation Guide and MakingServices.
Services are features exported by your application for the benefit of other applications. Services let you share the resources and capabilities of your application with other applications in the system.
Services are are accessible from contextual menu.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With