Skip to main content
added 673 characters in body
Source Link
azerbajdzan
  • 25.1k
  • 2
  • 22
  • 62

I would like to add another command to "Save as" menu that is generated by right clicking on selected text.

enter image description here

We have there "Plain Text" and after this I would like to add "Sagemath code". After clicking on it the text/code would be copied as plaintext with addition that spaces that represent multiplication would be replaced with "*".

For example if you "copy as plain text" this code 3 x^2 + 2 x + 1 you get string "3 x^2 + 2 x + 1" but I would like it to be 3*x^2 + 2*x + 1 because Sagemath recognizes only "*" as multiplication.

Sorry no code from me. I have no clues how to do it.

Update:

Why the code from here does not work anymore?

The code should rewrite the file MenuSetup.tr with new menu (in my code with unchanged default menu) but when I look at the file its modification time is not changed which means nothing was done to the file Wolfram Research\Mathematica\8.0\SystemFiles\FrontEnd\TextResources\Windows\MenuSetup.tr.

Begin["System`"];
menu = Get[
   FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", 
     "TextResources", "Windows", "MenuSetup.tr"}]];
End[];
FrontEndExecute[FrontEnd`ResetMenusPacket[menu]]

I would like to add another command to "Save as" menu that is generated by right clicking on selected text.

enter image description here

We have there "Plain Text" and after this I would like to add "Sagemath code". After clicking on it the text/code would be copied as plaintext with addition that spaces that represent multiplication would be replaced with "*".

For example if you "copy as plain text" this code 3 x^2 + 2 x + 1 you get string "3 x^2 + 2 x + 1" but I would like it to be 3*x^2 + 2*x + 1 because Sagemath recognizes only "*" as multiplication.

Sorry no code from me. I have no clues how to do it.

I would like to add another command to "Save as" menu that is generated by right clicking on selected text.

enter image description here

We have there "Plain Text" and after this I would like to add "Sagemath code". After clicking on it the text/code would be copied as plaintext with addition that spaces that represent multiplication would be replaced with "*".

For example if you "copy as plain text" this code 3 x^2 + 2 x + 1 you get string "3 x^2 + 2 x + 1" but I would like it to be 3*x^2 + 2*x + 1 because Sagemath recognizes only "*" as multiplication.

Sorry no code from me. I have no clues how to do it.

Update:

Why the code from here does not work anymore?

The code should rewrite the file MenuSetup.tr with new menu (in my code with unchanged default menu) but when I look at the file its modification time is not changed which means nothing was done to the file Wolfram Research\Mathematica\8.0\SystemFiles\FrontEnd\TextResources\Windows\MenuSetup.tr.

Begin["System`"];
menu = Get[
   FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", 
     "TextResources", "Windows", "MenuSetup.tr"}]];
End[];
FrontEndExecute[FrontEnd`ResetMenusPacket[menu]]
Source Link
azerbajdzan
  • 25.1k
  • 2
  • 22
  • 62

Add custom "Copy as" submenu

I would like to add another command to "Save as" menu that is generated by right clicking on selected text.

enter image description here

We have there "Plain Text" and after this I would like to add "Sagemath code". After clicking on it the text/code would be copied as plaintext with addition that spaces that represent multiplication would be replaced with "*".

For example if you "copy as plain text" this code 3 x^2 + 2 x + 1 you get string "3 x^2 + 2 x + 1" but I would like it to be 3*x^2 + 2*x + 1 because Sagemath recognizes only "*" as multiplication.

Sorry no code from me. I have no clues how to do it.