Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have written a small application and want to allow other applications to share data with it.

My first idea was to integrate it into the service menu. However, I need dynamically populated submenus and the Apple dev page for System Services states that "There are no submenus in the Services menu" since 10.6.

Are there any alternatives for integrating into the context menu of other applications and having submenus?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted
+50

Another alternative would be to expose only the top-level services, and then make it your app's responsibility to display the "submenu" choices.

This lends the benefit of putting you in control of keyboard shortcuts for the secondary choices. The user also gains a cleaner list of services.

share|improve this answer
    
That's probably the way I'll go as the other solutions also don't allow dynamic creation of entries. –  ubuntudroid Feb 5 '13 at 18:08
add comment

A better place to ask is probably the programmer forum http://stackoverflow.com/questions/tagged/osx

But offhand I think you can make a few different variants of your .app each one registering their own Services action. Those variants could then launch your "main" app to do the heavy lifting.

These variants could be bundled inside the main application, like I see some examples here:

/Applications/Adium.app/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app
/Applications/Android File Transfer.app/Contents/Frameworks/Breakpad.framework/Versions/A/Resources/crash_report_sender.app
/Applications/Android File Transfer.app/Contents/Resources/Android File Transfer Agent.app
/Applications/Android File Transfer.app/Contents/Resources/Android File Transfer Agent.app/Contents/Frameworks/Breakpad.framework/Versions/A/Resources/crash_report_sender.app
/Applications/Google Chrome Canary.app/Contents/Versions/26.0.1400.0/Google Chrome Framework.framework/Resources/app_mode_loader.app
/Applications/Google Chrome Canary.app/Contents/Versions/26.0.1400.0/Google Chrome Framework.framework/Resources/crash_report_sender.app
/Applications/Google Chrome Canary.app/Contents/Versions/26.0.1400.0/Google Chrome Helper EH.app
/Applications/Google Chrome Canary.app/Contents/Versions/26.0.1400.0/Google Chrome Helper NP.app
/Applications/Google Chrome Canary.app/Contents/Versions/26.0.1400.0/Google Chrome Helper.app
/Applications/Quicksilver.app/Contents/Resources/QSDroplet.app
/Applications/Stainless.app/Contents/Helpers/StainlessClient.app
/Applications/Firefox.app/Contents/MacOS/crashreporter.app
/Applications/Firefox.app/Contents/MacOS/plugin-container.app
/Applications/Firefox.app/Contents/MacOS/updater.app
/Applications/TextMate.app/Contents/SharedSupport/Bundles/ActionScript.tmbundle/Support/bin/XTrace.app
/Applications/TextMate.app/Contents/SharedSupport/Support/bin/CocoaDialog.app
/Applications/TextMate.app/Contents/SharedSupport/Support/bin/CommitWindow.app
/Applications/Xcode.app/Contents/Applications/Accessibility Inspector.app
/Applications/Xcode.app/Contents/Applications/Application Loader.app
/Applications/Xcode.app/Contents/Applications/FileMerge.app
/Applications/Xcode.app/Contents/Applications/Instruments.app
/Applications/Xcode.app/Contents/Applications/OpenGL ES Performance Detective.app
...
share|improve this answer
    
Didn't know about this possibility, great find! But it doesn't allow dynamic population of submenus (sorry for adding this requirement just now!) –  ubuntudroid Feb 5 '13 at 18:10
add comment

One alternative might be the AppleScript menu. It presents all scripts in the ~/Library/Scripts/ folder, and preserves the hierarchy of subfolders.

Issues:

  • You'd have to build AppleScript support into your app.
  • You'd have to build a bunch of AppleScripts to expose your functionality.
  • The AppleScript menu is disabled by default.
  • It's a kludgy hack.
share|improve this answer
    
Nice idea but doesn't allow dynamic population of submenus (sorry for adding this requirement just now!). –  ubuntudroid Feb 5 '13 at 18:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.