Ctrl+'key' to input a key?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
miatlas91

Ctrl+'key' to input a key?

19 Sep 2018, 04:41

Hello all,

I wanted to ask if one could use ctrl+ a number or a letter to type in a letter or key. I tried doing the follows to make Ctrl+2 type out a 1:

^2::1

but it didn't work. I looked thru the limitations section but didn't see ctrl+ combinations as not doable.

Am I just writing it wrong or are ctrl+key combos not workable for inputting single keys?

Thanks in advance!
User avatar
TheDewd
Posts: 1510
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Ctrl+'key' to input a key?

19 Sep 2018, 11:08

Try using Send.

Code: Select all

^2::
	Send, 1
return
User avatar
NovaRanger
Posts: 68
Joined: 23 Oct 2014, 02:05

Re: Ctrl+'key' to input a key?

19 Sep 2018, 11:16

Hello,

yes it doesn't seem to work. Strange, never knew that.
But I found a workaround for you

Code: Select all

^$2::Send, {1}
^$1::Send, {2}
; $ dollar is to ignore artificial strokes, assuming you are going to re map the whole keyboard.
miatlas91

Re: Ctrl+'key' to input a key?

20 Sep 2018, 09:00

Thank you NovaRanger and TheDewd. The solution works great!

There is one small item though which may be slightly off-topic:

I'd like to run the AHK file on startup. However, a couple of issues (using Windows 8.1):

1) The AHK script does not work with some programs apparently (i.e. while running, it will work in notepad, but not in the other program). This is corrected by running the AHK script via the Run as Administrator option.
2) But, I want the AHK script to automatically run as administrator at all times. For regular programs, there is a compatibility tab in their properties which allows users to do this. But with the AHK notepad, for some reason, this option is not there.

In short, I'd like to run the AHK script on startup, as administrator, at all times. Would like to ask if someone else has run into this issue and how they managed to sort it. I've tried looking for a solution, but haven't been successful thus far.

Thanks again!
User avatar
NovaRanger
Posts: 68
Joined: 23 Oct 2014, 02:05

Re: Ctrl+'key' to input a key?

20 Sep 2018, 11:47

Well, on my laptop everything has admin access (yes, it's a security issue but I have full control of what runs and what doesn't).
In your computer, go to the installation location of autohotkey, (it'll be in c:/programfiles), there try to change the autohotkey.exe to admin in compatibility mode.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 299 guests