This question about the use of AutoHotKey is specific to a Windows LaTeX editor called TeXnicCenter.
So, I was trying to write my first AutoHotKey (AHK) script, and wanted the shortcuts to be available only when the TeXniceCenter window was active. AHK provides the IfWinActive
keyword to deal with these scenarios, however, I ran into some difficulties in using this keyword.
Here is a draft file I wrote:
SetTitleMatchMode, 2
SetTitleMatchMode, Slow
#IfWinActive, .* TeXnicCenter *.
!t::
Send \texttt{{}{}}
return
The #IfWinActive, .* TeXnicCenter *.
line, so that the pattern "TeXnicCenter" is found somewhere in the window name does not work.
There were some other options that I discarded
I use TeXnicCenter mainly with projects, so that the window name shows up as "projectname - TeXnicCenter", so it is not feasible to use this as the argument to
IfWinActive
. Note that the window name is TeXnicCenter if working on standalone documents.Another option provided by AHK is that you use something called the
ahk_class
of the process, which is typically intuitive (and can be had from the handy bundled AHK tool, called Window Spy) -- for example, in the case of Chrome, it isChrome_WidgetWin_1
.
However, for TeXnicCenter, it shows the bizarre signature -- for example, for one of my projects, it is Afx:000000013F370000:8:0000000000010005:0000000000000000:0000000012B80087
, and not only that, it is not constant across TeXnicCenter windows, as it usually is for other processes.
I am at a loss -- does anyone have experience setting up AHK with TeXnicCenter, and using the IfWinActive
keyword? I have a feeling that this might be better directed at the developers of TeXnicCenter, but here's hoping.