Reputation: 871
So I want to map both keys:
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
Upvotes: 0
Views: 997
Reputation: 2344
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.
Upvotes: 4