This can be accomplished using LinkWrite
. You can place the following code in init.m
.
To add a color to the background colors submenu you can use...
LinkWrite[$ParentLink,
AddMenuCommands[
"BackgroundDialog", {Delimiter,
Item["M&y Color", Background -> RGBColor[0.980, 0.941, 0.902]]}]]
To add a link to the AddOns documentation you can use...
LinkWrite[$ParentLink,
AddMenuCommands[
"AboutBoxDialog", {Delimiter,
MenuItem["&AddOns Documentation...",
FrontEndExecute[{FrontEnd`NotebookOpen[
FrontEnd`FindFileOnPath["paclet:guide/InstalledAddOns",
"PrivatePathsSystemResources"]]}]]}]]
EDIT: Controlling the placement with this method seems hard since there is no documentation on the topic. It seems that AddMenuCommands
takes a front end token as the first input and then attempts to find the first instance in MenuSetup.tr
and replace immediately after that. I've spent about all the time I think its worth trying to figure out more and have come to the conclusion that if you want highly customized menus you will probably need to edit MenuSetup.tr
directly.
End EDIT:
Now, if you want to actually edit MenuSetup.tr
the following will accomplish the same as the above.
You can accomplish part 1 by adding the following code after line 628 of MenuSetup.tr which is located under /WolframResearch/Mathematica/8.0/SystemFiles/FrontEnd/TextResources/Windows in my case.
,
Delimiter,
MenuItem["&AddOns Documentation...",
FrontEndExecute[{FrontEnd`NotebookOpen[
FrontEnd`FindFileOnPath["paclet:guide/InstalledAddOns",
"PrivatePathsSystemResources"]]}]]
Note that "&AddOns Documentation..."
can contain any string beginning with "&" that you would like. The Delimiter
is also optional.
Part 2 can be accomplished by inserting the following after line 328.
,
Delimiter,
MenuItem["Custom",Background ->RGBColor[.5,.5,.5]]
Obviously, you can set this color to whatever you want.
I recommend saving a copy of MenuSetup.tr
before doing this since you can break things by messing with it.
FrontEnd`AddMenuCommands
really a command of Mathematica? Because I wasn't able to find it. The problem is, from what I have gathered, that the only way to add new commands to the menu is by hacking the .tr file. If it was an already established menu command you could have used the tokens to access it. Also, you can always make a palette with whatever functionality you wish ... $\endgroup$FrontEnd`AddMenuCommands
may be obsolete now but seems to have been an actual, if undocumented, command in earlier versions of Mathematica (perhaps it was really FrontEndExecute`.... ?). This appeared in forums.wolfram.com/mathgroup/archive/2009/Apr/msg00341.html and other posts in that same thread. $\endgroup$