12

I have customized the contextual menu for my Cocoa application such that only certain items are visible. In spite of my customization, I found that the system adds a menu item -- "Add to iTunes as a spoken track".

I tried removing this item from the menu but somehow, I am unable to get the control. Is there a way this item can be removed, or do I have to write an AppleScript to disable the iTunes option under Keyboard Shortcuts? I hate doing that since I will then have to restore it for the user.

Chuck Le Butt
  • 47,570
  • 62
  • 203
  • 289
Prashant
  • 2,190
  • 4
  • 33
  • 64

3 Answers3

63

You can control the contents of these menus (system-wide) by using Preferences.

See System Preferences > Keyboard > Keyboard Shortcuts > Services > Text

epelc
  • 5,300
  • 5
  • 22
  • 27
Bwooce
  • 2,123
  • 19
  • 28
  • 4
    This should be the accepted answer... perfect place to look for tweaking the contextual menu. Thanks @Bwooce ! – beefchimi Jan 06 '15 at 14:56
  • 6
    @beefchimi Although this resolves the issue for the developer, it does not solve the problem for users of the OP's application. That menu item will still appear for any user that has it enabled (and it is enabled by default on Yosemite). – bindsniper001 Jul 17 '15 at 18:00
  • 2
    This is actually the answer I came here looking for, but if you read the question, it's not the answer the OP is asking for. – Chuck Le Butt Dec 30 '16 at 02:22
0

In my experience, Apple's default items trigger off of the exact title of the menu. For example, I have a toy app with an NSMenu that I am creating entirely in code (no nib). I find that the View menu gets an extra item (for full screen) if I initialize it as follows:

    NSMenu* viewMenu = [[NSMenu alloc]initWithTitle:@"View"];

However, if I put an extra space into the name, then Apple doesn't mess with it:

    NSMenu* viewMenu = [[NSMenu alloc]initWithTitle:@"View "];
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
-8

Is there a way this item can be removed, or do I have to write an AppleScript to disable the iTunes option under Keyboard Shortcuts?

Don't fight with The System; those Service items are supposed to appear on every context menu, as specified in the System Preferences. It even appears on the context menu of Safari which I'm using to view this post right now. Yes I agree that having "add to iTunes" enabled by default is a poor choice on the part of Apple, but that's life.

Maybe the user has his/her own service item s/he installed say as an Automator action. In that case the user probably doesn't want to have it removed.

Yuji
  • 34,103
  • 3
  • 70
  • 88
  • 2
    Despite all the downvotes, this is actually the correct answer. Why? Because the OP is asking about his *own application* being able to change the *user's preferences*. None of us want an application changing our system prefs for us, and the OP is NOT asking for a way to change the prefs on their own system. – Chuck Le Butt Dec 30 '16 at 02:21
  • It's the poor consequences of being the first google result for _"remove add to itunes as a spoken track"_. – Emile Bergeron Jan 19 '17 at 16:38