AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

use capslock as a toggle

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
jamestr
Guest





PostPosted: Mon Apr 05, 2004 5:59 am    Post subject: use capslock as a toggle Reply with quote

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
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Mon Apr 05, 2004 12:42 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group