mIRC Home    About    Download    Register    News    Help

Print Thread
#119680 08/05/05 10:33 PM
Joined: Jan 2004
Posts: 509
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
I was wondering if anyone knew of a way for your mIRC to detect whether the caps lock button on your keyboard is on or not. And possibly making a custom identifier out of that.

This is so making a script like { if ($CapsLock == on) { /commands } }.

Basically, it could be used for if statements in certain channels that even if the caps lock is on, mIRC will override a $1- input string. But first...a way of getting mirc to recognize the caps lock button.

#119681 08/05/05 10:58 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
You'll need a dll for that.


New username: hixxy
#119682 08/05/05 11:10 PM
Joined: Jan 2004
Posts: 509
L
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
Yea, my point being. But I don't do dll's.

#119683 09/05/05 01:27 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
mahahahaha i just wasted 10 mins trying to detect capslock, before i remebered i disabled the key frown

#119684 09/05/05 01:13 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Unless there is a property in WMI that I couldn't find (quickly) to detect the state of the CapsLock key, then the only methods I know of require a Windows API call - which tidy just told you would require a dll call, with the dll just being a wrapper for that one API call.

Changing its state from within mIRC is very simple, but detecting its current state is not.

alias Toggle.CapsLock {
  • .comopen WSH WScript.Shell
    !.echo -q $com(WSH, SendKeys, 1, *bstr, {CAPSLOCK})
    .comclose WSH
}

/Toggle.CapsLock

I thought of using SendKeys to send [color:FF6666]a[/color] to a @window and then examining the contents of its $editbox(@window) to see if it === [color:FF6666]a[/color] or === [color:FF6666]A[/color], but it will just send what you tell it to send; even if you try using the Shift key (+) to send [color:FF6666]+a[/color], you'll still just get an [color:FF6666]A[/color], regardless of the current setting of the CapsLock key. The same holds true for sending [color:FF6666]a{CAPSLOCK}a[/color]: you'll always get [color:FF6666]aA[/color] in the editbox.

So, unless there is either a $dll call or a $com object you can access, you're out of luck.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#119685 09/05/05 02:04 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
If you have any version of MS Word on your system, you could use its application object.

Code:
alias capslock {
  var %a = a $+ $ticks
  .comopen %a word.application
  if $comerr { return Error }
  tokenize 32 $com(%a,capslock,2) $com(%a).result
  .comclose %a
  return $2
}

If that's not good for you (if you don't have Word), then you'll probably need a dll.


Gone.
#119686 10/05/05 12:04 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Nevermind, dll doesn't seem to work on other pc's.


Gone.

Link Copied to Clipboard