9
$\begingroup$

In this question, answers were given that worked to add items to some menu commands, e.g., additional colors on the Format > Background Color menu, or Help menu items. I have code for such in an init.m:

AddMenuCommands["OpenHelpLink",{Delimiter,
Item["Installed Add-Ons",FrontEndExecute[FrontEnd`FrontEndToken["OpenHelpLink",    
   {"guide/InstalledAddOns",Automatic}]]],
Item["Standard Extra Packages",FrontEndExecute[FrontEnd`FrontEndToken["OpenHelpLink",
   {"guide/StandardExtraPackages",Automatic}]]], Delimiter}];

AddMenuCommands["BackgroundDialog",{Delimiter,
Item["L&inen",Background->RGBColor[0.980,0.941,0.902]],
Item["A&liceBlue",Background->RGBColor[0.941,0.973,1.0]],
Delimiter,
Item["HelpBrowser Sand",Background->RGBColor[0.964706,0.929412,0.839216]],
Item["SlideShow Slate",Background->RGBColor[0.408011,0.440726,0.8]]
}];

The solution proposed there was to place that init.m into:

$UserBaseDirectory/Autoload/PacletManager/Configuration/FrontEnd/

However, this no longer seems to work with Mathematica 10.0.1. Yes, I did restart with a clean cache and clean preferences.

I note that in $UserBaseDirectory/Autoload/PacletManager/Configuration/FrontEnd/ there's already a file init_10.0.1.0. I even tried appending the code displayed above to that (and appending a semi-colon to the long SetOptions[$FrontEndSession... expression already in init_10.0.1.0, but still no change to the menus. Moreover, after I restart Mathematica, the added text has disappeared from init_10.0.1.0.

I'm using version-specific front end preferences, just as I had been doing with Mathematica versions 8 and 9.0.1, and, I think, version 10.0.0.

What am I doing wrong? How get this to work?

$\endgroup$
  • $\begingroup$ Have you ever obtained a satisfactory resolution of this issue? Thanks. $\endgroup$ – bbgodfrey May 9 '16 at 0:17
3
$\begingroup$

I have a partial answer to my question. In order to add menu items, e.g., to submenus of the Format menu for Mathematica version 10.0.1.

What to put in the init.m

FrontEndExecute[
AddMenuCommands["BackgroundDialog",
{Delimiter,
MenuItem["Linen",Background->RGBColor[0.980,0.941,0.902]],
MenuItem["AliceBlue",Background->RGBColor[0.941,0.973,1.0]],
MenuItem["MintCream",Background->RGBColor[0.961,1.0,0.980]],
MenuItem["LightYellow",Background->RGBColor[1.0,1.0,0.878]],
MenuItem["Smoke",Background->RGBColor[0.961,0.961,0.961]],
Item["MistyRose",Background->RGBColor[1.0,0.894,0.882]],
Delimiter,
MenuItem["HelpBrowser Straw",Background->RGBColor[0.960784,0.878431,0.666667]],
MenuItem["SlideShow Slate",Background->RGBColor[0.408011,0.440726,0.8]]}]];

FrontEndExecute[
AddMenuCommands["FontColorDialog", 
{Delimiter, 
Item["HelpBrowser Brick", FontColor -> RGBColor[0.592157, 0.313726, 0.313726]],
Item["Mocha", FontColor -> RGBColor[0.501961, 0.25098, 0]],
Item["Ocean", FontColor -> RGBColor[0, 0.25098, 0.501961]],
Item["Eggplant", FontColor -> RGBColor[0.25098, 0, 0.501961]]}]];

This works despite the information from Wolfram tech support that this can no longer be done!

Note that it does not work if the wrapping function FrontEndExecute is removed (although in previous Mathematica versions FrontEndExecute was not needed).

Where to put the init.m

That init.m will work if it's placed in $UserBaseDirectory/Autoload/FrontEnd.

However, it does not work if the same init.m is placed, instead, in $UserBaseDirectory/Autoload/PacletManager/Configuration/FrontEnd(which did work with previous Mathematica versions).

The remaining problem

What remains to be done is how to get the Help menu additions to work that were indicated in the original question.

A possible clue: in the system file MenuSetup.tr that, the Format and most other main menu items use the function Menu, but the item for the help menu uses instead the function HelpMenu.

$\endgroup$
  • $\begingroup$ I tried this on my machine, but unsuccessfully. It is strange. Instead I succeeded to install it into $InstallationDirectory/SystemFiles/Autoload/PacletManager/Kernel . This is already the second case when on my machine I cannot work with the init.m file where other people seem to easily work with it, but secceed at the mentioned position. I have a question, however. In my case all the items are repeated twice in the Menu/Format/FontColor and Menu/Format/BackgroundColor. Do you know any reason? $\endgroup$ – Alexei Boulbitch Nov 25 '14 at 9:32
  • $\begingroup$ @Alexei Boulbitch: The only reason I can think of for having items appear twice is that you have, in fact, two init.m's being read. I recommend against putting any files of your own, or editing any, in the $InstallationDirectory tree, if for no other reason than that they'll disappear whenever you upgrade with a new Mathematica version. $\endgroup$ – murray Nov 25 '14 at 18:03
0
$\begingroup$

I never did what you are trying to do. However, I added an add-on to the init.m file in order to always load it up together with Mma. I used then the init.m file situated here: ~\Wolfram Research\Mathematica\10.0\SystemFiles\Autoload\PacletManager\Kernel. May be you could try this. Please let me know, if you succeed.

$\endgroup$
  • $\begingroup$ @Alexi Boulbitch: Unfortunately, doing that does not allow the kernel to start at all for me. (I was surprised you gave directory starting at path ~\Wolfram Research\Mathematica\10.0\SystemFiles`, since my Mathematica.app is in \Applications. By any chance, did you mean to put the edited init.m` in Library\Mathematica\SystemFiles\Autoload\PacletManager\Kernel?) $\endgroup$ – murray Nov 15 '14 at 21:59
  • $\begingroup$ @murray No, not into Library. The complete path on my machine looks as follows: D:\Program Files\Wolfram Research\Mathematica\10.0\SystemFiles\Autoload\PacletManager\Kernel\init.m . This is dictated by the fact that I installed Mma on the disk D. I did not use it, however, for the task you have in mind. My aim was to provide loading of one of the packages together with Mma, since I use this package on the everyday basis. It works for me. $\endgroup$ – Alexei Boulbitch Nov 17 '14 at 8:29
  • $\begingroup$ I'm using OS X, not Windows. If I correctly translate what you're saying, you put the edited init.m into $InstallationDirectory/SystemFiles/Autoload/PacletManager/Kernel. If I do that, Mathematica hangs as soon as the Welcome splash screen appears. $\endgroup$ – murray Nov 17 '14 at 15:47
  • $\begingroup$ @murray Yes, I checked $InstallationDirectory and it, indeed, gives the directory I used. $\endgroup$ – Alexei Boulbitch Nov 18 '14 at 8:21
  • $\begingroup$ And editing the init.m so as add my AddMenuCommands there expressions (in separate initialization cells) locks up Mathematica. I need to force quit it, then remove the apparently offending code from /Applications/Mathematica.app/SystemFiles/Autoload/PacletManager/Kernel/init.m. $\endgroup$ – murray Nov 18 '14 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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