Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to modify hotkey binding for mathematica system menu items?

This problem has bothered me for a long time.As we know,in mathematica we can modify hotkey bindings through two files "KeyEventTranslations.tr" and "MenuSetup.tr",but some hotkeys that by default bind to system menu items(for example, in windows: Alt+F bind to File menu,Alt+E bind to Edit menu,Alt+I bind to Insert menu,etc.) don't show up in these files. My question is how to customize these kind of hotkeys? So that I can assign actions I have used more frequently to them.

I have noticed that in the file "MenuSetup.tr",changing position of the '&' symbol doesn't affect hotkey binding (for example,changing Menu["&File",{...}] to Menu["Fi&le",{...}]).

Any suggestions? Thank you very much!

like image 253
kptnw Avatar asked Jan 08 '12 02:01

kptnw


1 Answers

AutoHotKey is almost certainly the thing you want. You can define any bindings that you want and can even create macros. The bindings can be context sensitive, so they only work within a specific application. For example, here is an AutoHotKey script that defines 2 bindings for Notepad only and 1 binding for all windows except Notepad.

#IfWinActive, ahk_class Notepad
^a::MsgBox You pressed Ctrl-A while Notepad is active. Pressing Ctrl-A in any other window will pass the Ctrl-A keystroke to that window.
#c::MsgBox You pressed Win-C while Notepad is active.
#IfWinActive
#c::MsgBox You pressed Win-C while any window except Notepad is active.

I'm not sure what actions you want to bind to, but if they are Mathematica specific, it will take a little effort to write your script. You may have to define the bindings in Mathematica first, then use AutoHotKey to get the actual binding you want, for example to bind "Action X" to Ctrl-F.

like image 155
gogators Avatar answered Sep 17 '22 19:09

gogators