Autokey: Capslock and a character will not map to Left - autohotkey

I'm trying to use Capslock to modify hjkl to arrows to simulate vim but I keep getting an error.
Capslock & h::Left
I get an error:
Line Text: Left
Error: This line does not contain a recognised action
Capslock is later remapped to Esc.
If I use the mapping to fire off a new window it works without fault.
Is there a way to achieve this?
My keyboard doesn't have a left windows key so I cannot use the windows key.

Try this:
Capslock & h::send, {left}
It works for me this way.

Related

How to map CAPSLOCK to ESC and ESC to CAPSLOCK in Autohotkey?

So I want to map both keys:
Capslock to Esc
Esc to Capslock
And this script works for Capslock to Esc but it doesn't really work for Esc to Capslock. It causes a Capslock then Esc to be sent. I only want a Capslock sent:
Capslock::Esc
Esc::Capslock
Based on Griffin's Comment
$Capslock::Esc
$Esc::Capslock
The problem that you had was that one of the hotkeys you had was triggering another, which can be prevented by using the $ modifier.
From the docs:
This is usually only necessary if the script uses the Send command to
send the keys that comprise the hotkey itself, which might otherwise
cause it to trigger itself. The $ prefix forces the keyboard hook to
be used to implement this hotkey, which as a side-effect prevents the
Send command from triggering it. The $ prefix is equivalent to having
specified #UseHook somewhere above the definition of this hotkey.

Use hotkeys with function keys, modifier keys, and a letter keys

How can I use a hotkey that responds to pressing F24 & Shift D, for example? I want to press a function key (F#, not the key that is labeled "fn"), a modifier key, and a letter.
I am using a mouse with multiple side buttons; I'm using G Hub to send F24 when one of the mouse buttons is pressed. So I'm trying to have that mouse button act as another modifier key.
I'm able to do assign a hotkey with only F24 and a letter key. But I no matter what I try, I cannot do this with an added modifier key. When I try to run the script, I get the error "invalid key." I have tried this with the Shift key and with the Alt key, and neither will work.
This works:
F24 & D::MsgBox, hello
I've tried every alternat syntax shown in the documentation, but none of the following work.
F24 & {Alt} & D::MsgBox, hello
!{F42}D::
!{F42} & D::
F24 & ! & D::
{Alt} {F24} D::
F24 & +D::
Combinations of 3 or more hotkeys are not supported as described in the documentation you can use #if and GetKeyState
I don't know how are you generating F24 the following will work if you first press shift and then F12 and d if your keyboard generates F24 just replace F12 with F24
#if GetKeyState("Shift", "P")
F12 & d::MsgBox works
#If

Creating a hotkey with backslash in AutoHotkey

I want to create a hotkey using a backslash key (\). Namely, I would like to assign Media_Prev to Windows button + backslash. I have tried both LWin & \::Media_Prev and #\::Media_Prev. However, these do not work: it just normally sends the backslash character. In AutoHotkey's key history, I do see that both \ and LWin register when I press this key combination.
Interestingly, something like LWin & c::Media_Prev or #v::Media_Prev does work well, just not with the backslash character.
This worked for me, using AHK version 1.1.13.01
LWin & \:: run Notepad
you can also use scan codes - something like
SC15B & SC02B:: run Notepad
should have the same effect
reference: here
I successfully tested the following:
<#vk dc::Send {Media_Prev}
< is Left key
# is Windows key
VK DC is virtual key number DC (you can find this code using AHK menu View > Key History and Script Info). With VK, the same key works regardless of active keyboard layout.
Note: Don't do LWin & key or Ctrl & key etc... & has a bit different meaning. For the above purpose AHK provides prefixes as shown above, e.g. ^b or #F1 etc. See AHK help on Remapping Keys and Buttons

Remap Capslock to Esc and disable original Esc key in AutoHotkey

Remapping Capslock to Esc like so works:
Capslock::Esc
But when I add the following remappings (Esc, Alt-Esc, Ctrl-Esc):
Esc::
!Esc::
^Esc::
return
... for disabling the original Esc key, the Capslock remapping no longer works.
How can I remap Capslock to Esc and disable the original Esc key completely?
I hope you can help me, please.
As #vasili told, your Capslock goes to Esc, which is disabled.
From example in documentaition, I have found that, if you want to switch two keys you should write something like this:
a::b
b::a
So using this logic I tried to put some usually not used key:
Capslock::Esc
Esc::F15
^!Esc::F15
!Esc::F15
^Esc::F15
F1 through F24 - The 12 or more function keys at the top of most keyboards.
Here's an easier one using wildcard (*) and without mapping to unused key:
Capslock::Esc ; Remap Capslock to Esc
*Esc::return ; Disable Esc pressed with zero or any combination of modifiers
If it doesn't work, add a $ to block the trigger loop:
Capslock::Esc ; Remap Capslock to Esc
$*Esc::return ; Disable Esc pressed with zero or any combination of modifiers
To disable just certain combinations of Esc:
Capslock::Esc
$Esc::
$!Esc::
$^Esc::
return

Make a left Enter key with AutoHotkey, and also with a hot-key to resume the remapped key?

I'm thinking about to remap some key to behavior the Enter key for the left hand to easy access.
Then I find AutoHotkey and plan to map the Capslock key to Enter key. Also I need to resume to the Capslock key when I need it, so I also map the RAlt+Capslock to be the Capslock key.
However it doesn't work as expected. Anyone can give some advises?
Here's what I've tried:
Capslock::Enter
RAlt & Capslock::SendInput !{Capslock}
For now the second line can work but the first line doesn't work. When press the Capslock it doesn't send Enter key.
Try this
$CapsLock::Enter
RAlt & Capslock::SetCapsLockState, % GetKeyState("CapsLock", "T") ? "Off" : "On"