Re: Bind double-[ to keyboard shortcut
- To: mathgroup at smc.vnet.net
- Subject: [mg106297] Re: Bind double-[ to keyboard shortcut
- From: "perdalum at gmail.com" <perdalum at gmail.com>
- Date: Thu, 7 Jan 2010 02:33:58 -0500 (EST)
- References: <hhshqn$ks1$1@smc.vnet.net> <hhundd$nm6$1@smc.vnet.net>
By accident when searching for Mathematica and AppleScript ressources,
I stumbled upon the original blog-post. The solution resembles Peters:
Item[KeyEvent["[", Modifiers -> {Control}],
FrontEndExecute[{FrontEnd`NotebookWrite[FrontEnd`InputNotebook[],
"\[LeftDoubleBracket]", After]}]],
Item[KeyEvent["]", Modifiers -> {Control}],
FrontEndExecute[{FrontEnd`NotebookWrite[FrontEnd`InputNotebook[],
"\[RightDoubleBracket]", After]}]],
For future reference: http://qwan.org/2009/03/26/typing-=E2=9F=A6-and-=E2=
=9F=A7-in-mathematica/#comments
Thanks to you both!
..Per
On Jan 5, 7:49=C2 am, Peter Breitfeld <ph... at t-online.de> wrote:
> "perda... at gmail.com" wrote:
> > In a previous installation of Mathematica, I had (on a Mac) Command-
> > Alt-8 bound to the character representing double-[ for use in list
> > indexing.
>
> > I lost this setup in an upgrade and now I cannot create this
> > customization again :-(
>
> > Anyone know of what I'm talking?
>
> > Thanks in advance!
>
> > ..Per
>
> To achieve this I change the file
> /Applications/Mathematica.app/SystemFiles/FrontEnd/TextRessources/
> =C2 Macitosh/KeyEventTranslations.tr
>
> Add the following to this file: (BE CAREFUL, ALWAYS MAKE A COPY OF THIS
> FILE BEFORE EDITING IT, IF YOU MADE A MISTAKE, MATHEMATICA WILL NOT WORK
> ANY MORE)
>
> Item[KeyEvent["<",Modifiers->{Control}],
> =C2 =C2 =C2 FrontEndExecute[{FrontEnd`NotebookWrite[FrontEnd`Sel=
ectedNotebook[],
> =C2 =C2 =C2 =C2 "\[LeftDoubleBracket]\[RightDoubleBracket]",A=
fter],
> =C2 =C2 =C2 =C2 =C2 =C2 =C2 FrontEndToken["MovePrevi=
ous"]}]]
>
> Now Ctrl+ < =C2 will bring up the opening and closing double-brackets w=
ith
> the Cursor placed in between.
>
> I changed the other parentheses, brackets and braces the some way, e.g.
>
> Item[KeyEvent["("],
> =C2 =C2 =C2 FrontEndExecute[{FrontEnd`NotebookWrite[FrontEnd`Sel=
ectedNotebook[],
> =C2 =C2 =C2 =C2 "()",After], FrontEndToken["MovePrevious"]}]]
>
> --
> _________________________________________________________________
> Peter Breitfeld, Bad Saulgau, Germany --http://www.pBreitfeld.de