MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Urgent! Add Keyboard command to Mathematica FrontEnd (Mac)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg17064] Re: Urgent! Add Keyboard command to Mathematica FrontEnd (Mac)
  • From: "P.J. Hinton" <paulh>
  • Date: Fri, 23 Apr 1999 02:32:06 -0400
  • Organization: "Wolfram Research, Inc."
  • References: <innclip7fh2de$h1o@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 20 Apr 1999, Yohon Lo wrote:

> Hi, I need help on how to add keyboard command to mathematica FrontEnd for
> Macintosh. I want to add a key command for Save Selection As: Adobe
> Illustrator funtion, Function Key 12 or command-control-s. 
> 
> The MenuSetup.ml file is in text format, and I am have a hard time reading
> it. Any advices? 
> 
> Or hints on Creating a Palatte window to click on.

Paste this expression into a Mathematica 3.0 notebook and evaluate it.
This will create a button that, when clicked, will perform the same
operation as the front end menu command sequence Edit -> Save Selection As
-> Adobe Illustrator.

ButtonBox[
  StyleBox[
    "Save Selection as\nAdobe Illustrator",
    FontFamily -> "Helvetica"
  ],
  ButtonFunction :>
    FrontEndExecute[{
      FrontEndToken[
        FrontEnd`InputNotebook[],
        "SelectionSaveSpecial",
        "Illustrator"
      ]
    }],
  ButtonEvaluator -> None,
  Active -> True
] // DisplayForm

Alternatively, you can copy the file:

ToFileName[{$TopDirectory, "SystemFiles", "FrontEnd", "TextResources"},
  "MenuSetup.tr"]

to a newly created folder with path:

ToFileName[{$PreferencesDirectory, "SystemFiles", "FrontEnd",
  "TextResources"}]

And edit this file by adding the following Item:

Item[
  KeyEvent["s", Modifiers -> {Command, Control}],
  FrontEndExecute[{
    FrontEndToken[
      FrontEnd`InputNotebook[],
      "SelectionSaveSpecial",
      "Illustrator"
    ]
  }]
]

Be sure to add a comma after the Item[] expression if it is not at the end
of the list that contains all of the Item[] expressions.

For more information on the use of FrontEndToken[] expressions like those
above, see _The Beginner's Guide to Mathematica Version 3_ by Glynn and
Gray, Chapter 56.

--
P.J. Hinton
Mathematica Programming Group           paulh at wolfram.com
Wolfram Research, Inc.                  http://www.wolfram.com/~paulh/
Disclaimer: Opinions expressed herein are those of the author alone.



  • Prev by Date: Re: ?-Can complete notebooks be converted to Postscript?
  • Next by Date: Re: Plotting Tajectories with Mathematica
  • Previous by thread: Urgent! Add Keyboard command to Mathematica FrontEnd (Mac)
  • Next by thread: Plotting different shadings in SphericalPlot3D