On/Off Key Switches?

Get help with using AutoHotkey and its commands and hotkeys
abcjme
Posts: 65
Joined: 08 Mar 2018, 10:48

On/Off Key Switches?

16 Jun 2018, 20:45

Is there a way to make certain keys act like switches? Very much like CapsLock, except that the keys sensitive to the switching could be specified.

For example:
If I press "z" once (with no holding involved), then pressing "a" will output "1" and pressing "b" will output "2".
However, if I press "z" again (with no holding involved), then "a" will simply output "a", and "b" will simply output "b".
icuurd12b42
Posts: 202
Joined: 14 Aug 2016, 04:08

Re: On/Off Key Switches?

18 Jun 2018, 05:42

Code: Select all

...
toggle := false
::z
toggle := ! toggle
return

::a
if(toggle)
    Send, 1
else
    Send, a
return
you'll need to figure out if you want to send A or a is caps or shift is down...
abcjme
Posts: 65
Joined: 08 Mar 2018, 10:48

Re: On/Off Key Switches?

01 Jul 2018, 16:30

icuurd12b42 wrote:

Code: Select all

...
toggle := false
::z
toggle := ! toggle
return

::a
if(toggle)
    Send, 1
else
    Send, a
return
you'll need to figure out if you want to send A or a is caps or shift is down...
That didn't quite work, but I did get it to work with this:

Code: Select all

z::
toggle := ! toggle
return

a::
if(toggle)
send b
else
send c
icuurd12b42
Posts: 202
Joined: 14 Aug 2016, 04:08

Re: On/Off Key Switches?

02 Jul 2018, 02:16

odd that you don't need toggle to be defined and initialized... cool

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Canengy, RickC and 145 guests