Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to add some items to the Mathematica 8.0.4 Help menu (under Mac OS X). In

 [$UserBaseDirectory]/Autoload/FrontEnd/init.m

I have the following cell:

  FrontEnd`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}]

but the items are not added to the Help menu when I start Mathematica.

Do I have the syntax wrong, or should this go in some other init.m?

share|improve this question
    
Possible duplicate of mathematica.stackexchange.com/q/907/46? –  Heike Feb 10 '12 at 20:05
    
so, does this work when you run it interactively? –  acl Feb 10 '12 at 20:24
    
You are missing a closing ] in the code above. It works for me when put under $UserBaseDirectory/Autoload/PacletManager/Configuration/FrontEnd. It seem that the path you are using is not scanned for init.m files when MMa is starting up. –  Matariki Feb 10 '12 at 20:29
    
Sorry about the missing terminal ] in the code; a copy-paste error. I fixed that. –  murray Feb 10 '12 at 22:41
    
About@Matariki comment that the init.m can be placed in $UserBaseDirectory/Autoload/PacletManager/Configuration/FrontEnd: I'm using versioned preferences, and that directory already has an init_8.0.4.m with the following code: SetOptions[$FrontEndSession, PrivatePaths -> {"SystemResources" -> {ParentList}, "TextResources" -> {FrontEnd`FileName[{"/Applications/Math/Mathematica.app/\ AddOns/Applications/WolframAlphaClient/./FrontEnd", "TextResources"}, "PacletManager" -> True, "Prepend" -> True], ParentList}}] What to do? –  murray Feb 10 '12 at 22:45
show 2 more comments

1 Answer 1

up vote 6 down vote accepted

I can only speak for Windows but I would expect the solution should be similar for Mac.

I created a file $BaseDirectory\FrontEnd\init.m

In that file I added the following lines. Note they are slightly different than what you provide but should do what you want.

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

I attempted to do this using $UserBaseDirectory\FrontEnd but Mathematica insists on wiping out any changes I make to the init.m file that already exists there.

EDIT:

Following the comment by @Matariki one can place the init.m file in $UserBaseDirectory\Autoload\PacletManager\Configuration\FrontEnd\ instead. I'm not sure which is preferable. The $BaseDirectory installation should add the customization for any user on the machine whereas the $UserBaseDirectory option will only work for the selected user.

Extension:

Also worth noting is that "AboutBoxDialog" is a front end token that can be found in MenuSetup.tr located in $InstallationDirectory/SystemFiles/FrontEnd/TextResources/.

These tokens, to my knowledge, are the only way to control the placement of new commands in menus. I could for example have added a background color to the Format>Background Colors menu by noting that "BackgroundDialog" is the token closest to the relevant menu in MenuSetup.tr. Adding the following code to the previously mentioned init.m will add a Linen color to the Background Colors sub-menu.

FrontEndExecute[ 
  AddMenuCommands["BackgroundDialog", {Delimiter, 
   Item["L&inen",Background->RGBColor[0.980,0.941,0.902]]}]];
share|improve this answer
    
Drat: I was hoping I could isolate any such change to $UserBaseDirectory and away from $BaseDirectory -- so that the change would definitely be preserved across upgrades or (in case needed) re-installation. I think the only difference between your version and mine is that I included Delimiter before and after the other items. My version of the init.m does work for Mac in $$BaseDirectory/FrontEnd/init.m. –  murray Feb 10 '12 at 21:58
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.