# TeXnicCenter - hotkeys for user-defined command or AutoHotkey without overwriting marked content?

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?

-

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

-
why only F-keys? –  user1234567890 Feb 17 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 at 13:21
Just to go sure: This is an Autohotkey script? Please add a short info. –  Speravir Feb 17 at 18:55
Yes, this is Autohotkey. –  Uwe Ziegenhagen Feb 17 at 19:05