Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

use capslock as a toggle


  • Please log in to reply
1 reply to this topic
jamestr
  • Guests
  • Last active:
  • Joined: --
this script uses the capslock key to give a hotkey 2 different outputs.

up::
GetKeyState, capstate, capslock, t
Loop
{
GetKeyState, state, up, P
if state = D
if capstate = d
{
send, e
break
}
else
if capstate = u
{
send, {up}
break
}
}
return

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Using the state of keys to change the actions of others is a good idea. Note: That particular script probably won't work on Windows 9x because retrieving the Capslock state on those OSes is unreliable (as documented).

A related idea is to use Capslock a modifier (though this won't work on Win9x yet):

Capslock & a::MsgBox, You pressed A while holding down Capslock.

When this hotkey is pressed, the state of the Capslock key will not be changed. This allows Capslock to be a true modifier with no side-effects.

Btw, if anyone is wondering how to get the forum to accept indentation, the only way I know is to use the "Code" button to enclose your code and make sure you use hard spaces rather than tabs. I wonder if there's an easier way.