Hi whats up

UserInput.dll v.1.1 

This dll signals mirc if the user presses a key, moves the mouse, clicks or uses the mousewheel. It has some other functions too.



Functions:

start <keys?> <mousemoves?> <mouseclicks?>

-> starts input listening
-> <keys?> <mousemoves?> <mouseclicks?>: send signals for key inputs 0 or 1, same for mousemoves and mouseclicks
-> returns: "ok" or "error already running"
-> example: "/dll userinput.dll start 0 1 0" will only /signal all mousemoves

options <keys?> <mousemoves?> <mouseclicks?>

-> changes the signal options even if you already started listening on the inputs
-> <keys?> <mousemoves?> <mouseclicks?>: send signals for key inputs 0 or 1, same for mousemoves and mouseclicks

stop

-> stops listening, you can also just close mirc or unload the dll
-> returns: "ok" or "error not running"

getKeyStates

-> returns: <k0> <k1> <k2> <k3> <k4> <k5> <....
-> for example if <k17> is > 0 it means that shift is pressed. you need this function to find out what ascii is being sent, for example if the user presses the 7 key it can be / or {. you have to check the keystate of alt and strg. or simply to find out if it's a or A. i was too lazy to write a key2ascii function i think you can do this with msl

getActiveWindow

-> returns: <ismirc> <hwnd> <title text>
-> ismirc=1 if active window is mirc, 0 if it's not mirc | hwnd=active window hwnd | title text=active window text



Signals:

on *:signal:UserInput:echo -a $1-

just debug some inputs to understand the matrix ;-)


Example script:

alias debug_inputs {
  window @debug_inputs
  dll UserInput.dll start .
}
on *:signal:UserInput: {
  var %x = $dll(UserInput.dll,getActiveWindow,.)
  echo @debug_inputs The Active Window is $iif(!$gettok(%x,1,32),not)  mIRC (hWnd: $gettok(%x,2,32) $+ ): $gettok(%x,3-,32)
  if ($2 == 512) {
    echo @debug_inputs Mouse Move to X: $3 Y: $4
  }
  elseif ($2 == 513) {
    echo @debug_inputs Left Mouse Down at X: $3 Y: $4 (hWnd: $1)
  }
  elseif ($2 == 514) {
    echo @debug_inputs Left Mouse Up at X: $3 Y: $4 (hWnd: $1)
  }
  elseif ($2 == 516) {
    echo @debug_inputs Right Mouse Down at X: $3 Y: $4 (hWnd: $1)
  }
  elseif ($2 == 517) {
    echo @debug_inputs Right Mouse Up at X: $3 Y: $4 (hWnd: $1)
  }
  elseif ($2 == 522) {
    echo @debug_inputs Mouse Wheel at X: $3 Y: $4 
  }
  elseif ($2 == 519) {
    echo @debug_inputs Middle Mouse Down at X: $3 Y: $4 (hWnd: $1)
  }
  elseif ($2 == 520) {
    echo @debug_inputs Middle Mouse Up at X: $3 Y: $4 (hWnd: $1)
  }
  elseif ($2 == 256) {
    if ($3 isnum 16-26 || $3 isnum 30-40 || $3 isnum 44-50) {
      echo @debug_inputs Key Input: $3 ( $+ $toascii($3) $+ ) 
    }
    else {
      echo @debug_inputs Key Input: $3
    }
  }
  elseif ($2 == 257) {
    echo @debug_inputs Key Up: $3
  }
  elseif ($2 == 260) {
    echo @debug_inputs Alt Down: left
  }
  elseif ($2 == 261) {
    echo @debug_inputs Alt Up: $iif($3 == 56,left,right)
  }

}
alias -l toascii {
  if ($1 == 16) var %b = q
  elseif ($1 == 17) var %b = w
  elseif ($1 == 18) var %b = e
  elseif ($1 == 19) var %b = r
  elseif ($1 == 20) var %b = t
  elseif ($1 == 21) var %b = z
  elseif ($1 == 22) var %b = u
  elseif ($1 == 23) var %b = i
  elseif ($1 == 24) var %b = o
  elseif ($1 == 25) var %b = p
  elseif ($1 == 26) var %b =   
  elseif ($1 == 30) var %b = a
  elseif ($1 == 31) var %b = s
  elseif ($1 == 32) var %b = d
  elseif ($1 == 33) var %b = f
  elseif ($1 == 34) var %b = g
  elseif ($1 == 35) var %b = h
  elseif ($1 == 36) var %b = j
  elseif ($1 == 37) var %b = k
  elseif ($1 == 38) var %b = l
  elseif ($1 == 39) var %b = 
  elseif ($1 == 40) var %b = 
  elseif ($1 == 44) var %b = y
  elseif ($1 == 45) var %b = x
  elseif ($1 == 46) var %b = c
  elseif ($1 == 47) var %b = v
  elseif ($1 == 48) var %b = b
  elseif ($1 == 49) var %b = n
  elseif ($1 == 50) var %b = m
  tokenize 32 $dll(userinput.dll,getKeyStates,.)
  var %u = 0
  if ($17 > 1) {
    var %u = $iif(%u,0,1)
  }
  if ($21) {
    var %u = $iif(%u,0,1)
  }
  if (%u) {
    return $upper(%b)
  }
  return %b
}
