Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

defined commands which I want to use in fast way. I tried to make a short hotkey, not the long default one for inserting own text blocks, but I did not find an option for that. Then I thought I would use AutoHotkey, but normally in TeXnicCenter when you select some text and use a command like \textit{}the text wont be overwritten. If I use Autohotkey for my customized command, I select my text and it will be overwritten.

Is there a solution I did not see?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Well, it is possible at least for the F-keys. The following script copies the selected text, inserts \command{}, moves the cursor left and inserts the text again.

F4::
Send ^c
Send \command{{}{}}{LEFT}
Send ^v
Return
share|improve this answer
    
why only F-keys? –  user1234567890 Feb 17 '13 at 12:08
    
Well, F-keys do not mess with the text you entered, for combinations like Alt+<Key> it should probably work as well. But as soon as any keys are printed out, you do not have the original chars to copy to the clipboard. –  Uwe Ziegenhagen Feb 17 '13 at 13:21
    
Just to go sure: This is an Autohotkey script? Please add a short info. –  Speravir Feb 17 '13 at 18:55
    
Yes, this is Autohotkey. –  Uwe Ziegenhagen Feb 17 '13 at 19:05

It's been a while since this question was asked but I had the same problem and solved it with an AutoIt script:

include

$dll = DllOpen("user32.dll")
While 1   
   if _IsPressed("05") then 
      WinActivate("XXX")
      Send("!im2")
   EndIf 
   if _IsPressed("04") then 
      WinActivate("XXX")
      Send("!im1")
   EndIf
   Sleep(100)
WEnd
DllClose($dll)

Exit

Instead of "XXX" you type just the beginning of the window's name of TeXnicCenter (usually the project's name).

The parameter of the _IsPressed-function defines the hotkey (04 for middle mouse button, 05 for X1 mouse button).

"!im2" means it presses ALT+i to get into the insert menu, then m and 2

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.