Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

Here's how to add a permanent menu item and keyboard shortcut for Silvia's solutionSilvia's solution. (This can be easily adapted to Jens' solution for Mac OSsolution for Mac OS.)

enter image description here

1. Add Package

Copy Silvia's first code block that starts with Needs["NETLink`"] to a file and save it as UniCodeCopy.m in one of the directories included in $Path.

2. Initialize the Front End

Save the following to the file $UserBaseDirectory/Autoload/FrontEnd/init.m (create it if needed):

Needs["UniCodeCopy`"]

CopySelectionAsUnicode[] :=
    Module[{selection, code},
           FrontEndExecute[FrontEndToken["CopySpecial", "InputText"]];
           selection = NotebookGet[ClipboardNotebook[]][[1, 1, 1]];
           code = StringReplace[selection, {"\\\n" -> "",
                                            "\n" ~~ space : " " ... :> StringJoin["\n", ConstantArray[space, 4]]}];
           UniCodeCopy`WriteToClipboardUnicode[code];]

FrontEndExecute[
    FrontEnd`AddMenuCommands["Copy",
                             {MenuItem["Copy as Unicode",
                                       FrontEndExecute[CopySelectionAsUnicode[]],
                                       (* Alt + U *)
                                       MenuKey["u", Modifiers -> {"Command"}],
                                       System`MenuEvaluator -> Automatic,
                                       Method -> "Queued"]}]]
    

For key bindings, the possible modifiers are "Shift", "Control", "Command" (Alt) and "Option" (Alt).

(It took me a few hours to figure this out. I hope this proves useful for other struggling novices.)

Here's how to add a permanent menu item and keyboard shortcut for Silvia's solution. (This can be easily adapted to Jens' solution for Mac OS.)

enter image description here

1. Add Package

Copy Silvia's first code block that starts with Needs["NETLink`"] to a file and save it as UniCodeCopy.m in one of the directories included in $Path.

2. Initialize the Front End

Save the following to the file $UserBaseDirectory/Autoload/FrontEnd/init.m (create it if needed):

Needs["UniCodeCopy`"]

CopySelectionAsUnicode[] :=
    Module[{selection, code},
           FrontEndExecute[FrontEndToken["CopySpecial", "InputText"]];
           selection = NotebookGet[ClipboardNotebook[]][[1, 1, 1]];
           code = StringReplace[selection, {"\\\n" -> "",
                                            "\n" ~~ space : " " ... :> StringJoin["\n", ConstantArray[space, 4]]}];
           UniCodeCopy`WriteToClipboardUnicode[code];]

FrontEndExecute[
    FrontEnd`AddMenuCommands["Copy",
                             {MenuItem["Copy as Unicode",
                                       FrontEndExecute[CopySelectionAsUnicode[]],
                                       (* Alt + U *)
                                       MenuKey["u", Modifiers -> {"Command"}],
                                       System`MenuEvaluator -> Automatic,
                                       Method -> "Queued"]}]]
    

For key bindings, the possible modifiers are "Shift", "Control", "Command" (Alt) and "Option" (Alt).

(It took me a few hours to figure this out. I hope this proves useful for other struggling novices.)

Here's how to add a permanent menu item and keyboard shortcut for Silvia's solution. (This can be easily adapted to Jens' solution for Mac OS.)

enter image description here

1. Add Package

Copy Silvia's first code block that starts with Needs["NETLink`"] to a file and save it as UniCodeCopy.m in one of the directories included in $Path.

2. Initialize the Front End

Save the following to the file $UserBaseDirectory/Autoload/FrontEnd/init.m (create it if needed):

Needs["UniCodeCopy`"]

CopySelectionAsUnicode[] :=
    Module[{selection, code},
           FrontEndExecute[FrontEndToken["CopySpecial", "InputText"]];
           selection = NotebookGet[ClipboardNotebook[]][[1, 1, 1]];
           code = StringReplace[selection, {"\\\n" -> "",
                                            "\n" ~~ space : " " ... :> StringJoin["\n", ConstantArray[space, 4]]}];
           UniCodeCopy`WriteToClipboardUnicode[code];]

FrontEndExecute[
    FrontEnd`AddMenuCommands["Copy",
                             {MenuItem["Copy as Unicode",
                                       FrontEndExecute[CopySelectionAsUnicode[]],
                                       (* Alt + U *)
                                       MenuKey["u", Modifiers -> {"Command"}],
                                       System`MenuEvaluator -> Automatic,
                                       Method -> "Queued"]}]]
    

For key bindings, the possible modifiers are "Shift", "Control", "Command" (Alt) and "Option" (Alt).

(It took me a few hours to figure this out. I hope this proves useful for other struggling novices.)

added 22 characters in body
Source Link
ens
  • 591
  • 3
  • 8

Here's how to add a permanent menu item and keyboard shortcut for Silvia's solution. (This can be easily adapted to Jens' solution for Mac OS.)

enter image description here

1. Add Package

Copy Silvia's first code block that starts with Needs["NETLink`"] to a file and save it as UniCodeCopy.m in one of the directories included in $Path.

2. Initialize the Front End

Save the following to the file $UserBaseDirectory/Autoload/FrontEnd/init.m (create it if needed):

Needs["UniCodeCopy`"]

CopySelectionAsUnicode[] :=
    Module[{selection, code},
           FrontEndExecute[FrontEndToken["CopySpecial", "InputText"]];
           selection = NotebookGet[ClipboardNotebook[]][[1, 1, 1]];
           code = StringReplace[selection, {"\\\n" -> "",
                                            "\n" ~~ space : " " ... :> StringJoin["\n", ConstantArray[space, 4]]}];
           UniCodeCopy`WriteToClipboardUnicode[code];]

FrontEndExecute[
    FrontEnd`AddMenuCommands["Copy",
                             {MenuItem["Copy as Unicode",
                                       FrontEndExecute[CopySelectionAsUnicode[]],
                                       (* Alt + U *)
                                       MenuKey["u", Modifiers -> {"Command"}],
                                       System`MenuEvaluator -> Automatic,
                                       Method -> "Queued"]}]]
    

For key bindings, the possible modifiers are "Shift", "Control", "Command" (Alt) and "Option" (Alt).

(It took me a few hours to figure this out. I hope this proves useful for other struggling novices.)

Here's how to add a permanent menu item and keyboard shortcut for Silvia's solution. (This can be easily adapted to Jens' solution for Mac OS.)

enter image description here

1. Add Package

Copy Silvia's first code block that starts with Needs["NETLink`"] to a file and save it as UniCodeCopy.m in one of the directories included in $Path.

2. Initialize the Front End

Save the following to the file $UserBaseDirectory/Autoload/FrontEnd/init.m:

Needs["UniCodeCopy`"]

CopySelectionAsUnicode[] :=
    Module[{selection, code},
           FrontEndExecute[FrontEndToken["CopySpecial", "InputText"]];
           selection = NotebookGet[ClipboardNotebook[]][[1, 1, 1]];
           code = StringReplace[selection, {"\\\n" -> "",
                                            "\n" ~~ space : " " ... :> StringJoin["\n", ConstantArray[space, 4]]}];
           UniCodeCopy`WriteToClipboardUnicode[code];]

FrontEndExecute[
    FrontEnd`AddMenuCommands["Copy",
                             {MenuItem["Copy as Unicode",
                                       FrontEndExecute[CopySelectionAsUnicode[]],
                                       (* Alt + U *)
                                       MenuKey["u", Modifiers -> {"Command"}],
                                       System`MenuEvaluator -> Automatic,
                                       Method -> "Queued"]}]]
    

For key bindings, the possible modifiers are "Shift", "Control", "Command" (Alt) and "Option" (Alt).

(It took me a few hours to figure this out. I hope this proves useful for other struggling novices.)

Here's how to add a permanent menu item and keyboard shortcut for Silvia's solution. (This can be easily adapted to Jens' solution for Mac OS.)

enter image description here

1. Add Package

Copy Silvia's first code block that starts with Needs["NETLink`"] to a file and save it as UniCodeCopy.m in one of the directories included in $Path.

2. Initialize the Front End

Save the following to the file $UserBaseDirectory/Autoload/FrontEnd/init.m (create it if needed):

Needs["UniCodeCopy`"]

CopySelectionAsUnicode[] :=
    Module[{selection, code},
           FrontEndExecute[FrontEndToken["CopySpecial", "InputText"]];
           selection = NotebookGet[ClipboardNotebook[]][[1, 1, 1]];
           code = StringReplace[selection, {"\\\n" -> "",
                                            "\n" ~~ space : " " ... :> StringJoin["\n", ConstantArray[space, 4]]}];
           UniCodeCopy`WriteToClipboardUnicode[code];]

FrontEndExecute[
    FrontEnd`AddMenuCommands["Copy",
                             {MenuItem["Copy as Unicode",
                                       FrontEndExecute[CopySelectionAsUnicode[]],
                                       (* Alt + U *)
                                       MenuKey["u", Modifiers -> {"Command"}],
                                       System`MenuEvaluator -> Automatic,
                                       Method -> "Queued"]}]]
    

For key bindings, the possible modifiers are "Shift", "Control", "Command" (Alt) and "Option" (Alt).

(It took me a few hours to figure this out. I hope this proves useful for other struggling novices.)

deleted 51 characters in body
Source Link
ens
  • 591
  • 3
  • 8

Here's how to add a permanent menu item and keyboard shortcut for Silvia's solution. (This can be easily adapted to Jens' solution for Mac OS.)

enter image description here

1. Add Package

Copy Silvia's first code block that starts with Needs["NETLink`"] to a file and save it as UniCodeCopy.m in one of the directories included in $Path.

2. Initialize the Front End

Save the following to the file $UserBaseDirectory/Autoload/FrontEnd/init.m. You might need to create some of the directories.:

Needs["UniCodeCopy`"]

CopySelectionAsUnicode[] :=
    Module[{selection, code},
           FrontEndExecute[FrontEndToken["CopySpecial", "InputText"]];
           selection = NotebookGet[ClipboardNotebook[]][[1, 1, 1]];
           code = StringReplace[selection, {"\\\n" -> "",
                                            "\n" ~~ space : " " ... :> StringJoin["\n", ConstantArray[space, 4]]}];
           UniCodeCopy`WriteToClipboardUnicode[code];]

FrontEndExecute[
    FrontEnd`AddMenuCommands["Copy",
                             {MenuItem["Copy as Unicode",
                                       FrontEndExecute[CopySelectionAsUnicode[]],
                                       (* Alt + U *)
                                       MenuKey["u", Modifiers -> {"Command"}],
                                       System`MenuEvaluator -> Automatic,
                                       Method -> "Queued"]}]]
    

For key bindings, the possible modifiers are "Shift", "Control", "Command" (Alt) and "Option" (Alt).

(It took me a few hours to figure this out. I hope this proves useful for other struggling novices.)

Here's how to add a permanent menu item and keyboard shortcut for Silvia's solution. (This can be easily adapted to Jens' solution for Mac OS.)

enter image description here

1. Add Package

Copy Silvia's first code block that starts with Needs["NETLink`"] to a file and save it as UniCodeCopy.m in one of the directories included in $Path.

2. Initialize the Front End

Save the following to the file $UserBaseDirectory/Autoload/FrontEnd/init.m. You might need to create some of the directories.

Needs["UniCodeCopy`"]

CopySelectionAsUnicode[] :=
    Module[{selection, code},
           FrontEndExecute[FrontEndToken["CopySpecial", "InputText"]];
           selection = NotebookGet[ClipboardNotebook[]][[1, 1, 1]];
           code = StringReplace[selection, {"\\\n" -> "",
                                            "\n" ~~ space : " " ... :> StringJoin["\n", ConstantArray[space, 4]]}];
           UniCodeCopy`WriteToClipboardUnicode[code];]

FrontEndExecute[
    FrontEnd`AddMenuCommands["Copy",
                             {MenuItem["Copy as Unicode",
                                       FrontEndExecute[CopySelectionAsUnicode[]],
                                       (* Alt + U *)
                                       MenuKey["u", Modifiers -> {"Command"}],
                                       System`MenuEvaluator -> Automatic,
                                       Method -> "Queued"]}]]
    

For key bindings, the possible modifiers are "Shift", "Control", "Command" (Alt) and "Option" (Alt).

(It took me a few hours to figure this out. I hope this proves useful for other struggling novices.)

Here's how to add a permanent menu item and keyboard shortcut for Silvia's solution. (This can be easily adapted to Jens' solution for Mac OS.)

enter image description here

1. Add Package

Copy Silvia's first code block that starts with Needs["NETLink`"] to a file and save it as UniCodeCopy.m in one of the directories included in $Path.

2. Initialize the Front End

Save the following to the file $UserBaseDirectory/Autoload/FrontEnd/init.m:

Needs["UniCodeCopy`"]

CopySelectionAsUnicode[] :=
    Module[{selection, code},
           FrontEndExecute[FrontEndToken["CopySpecial", "InputText"]];
           selection = NotebookGet[ClipboardNotebook[]][[1, 1, 1]];
           code = StringReplace[selection, {"\\\n" -> "",
                                            "\n" ~~ space : " " ... :> StringJoin["\n", ConstantArray[space, 4]]}];
           UniCodeCopy`WriteToClipboardUnicode[code];]

FrontEndExecute[
    FrontEnd`AddMenuCommands["Copy",
                             {MenuItem["Copy as Unicode",
                                       FrontEndExecute[CopySelectionAsUnicode[]],
                                       (* Alt + U *)
                                       MenuKey["u", Modifiers -> {"Command"}],
                                       System`MenuEvaluator -> Automatic,
                                       Method -> "Queued"]}]]
    

For key bindings, the possible modifiers are "Shift", "Control", "Command" (Alt) and "Option" (Alt).

(It took me a few hours to figure this out. I hope this proves useful for other struggling novices.)

added 4 characters in body
Source Link
ens
  • 591
  • 3
  • 8
Loading
Source Link
ens
  • 591
  • 3
  • 8
Loading