Jump to content

Chr ( ASCIIcode )


Recommended Posts

I am using this code and it works for what I need it for. However it cannot tell the difference between lowercase and uppercase. It always returns uppercase :think:

Any help is much appreciated.

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

Global Const $WH_KEYBOARD_LL = 13
Global $hHook
Global $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam")
Global $hmod = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
Global $hHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", _
$WH_KEYBOARD_LL, "ptr", DllCallbackGetPtr($hStub_KeyProc), "hwnd", $hmod[0], "dword", 0)
Global $buffer = ""

While 1
    Sleep(10)
WEnd

Func EvaluateKey($keycode)

 If $keyCode = 97 then
        Msgbox(0, 'Winner!', 'Somebody pressed a')
    EndIf

 If $keyCode = 65 then
        Msgbox(0, 'Winner!', 'Somebody pressed A')
    EndIf

        Switch $buffer

            Case $buffer

        EndSwitch
;    Else
    ;   $buffer = ""
 ;   EndIf
EndFunc   ;==>EvaluateKey

Func _KeyProc($nCode, $wParam, $lParam)
    Local $ret, $KEYHOOKSTRUCT
    If $nCode < 0 Then
        $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook[0], _
                "int", $nCode, "wparam", $wParam, "lparam", $lParam)
        Return $ret[0]
    EndIf
    If $wParam = 256 Then
        $KEYHOOKSTRUCT = DllStructCreate("dword;dword;dword;dword;ptr", $lParam)
        EvaluateKey(DllStructGetData($KEYHOOKSTRUCT, 1))
    EndIf
    $ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook[0], _
            "int", $nCode, "ptr", $wParam, "ptr", $lParam)
    Return $ret[0]
EndFunc   ;==>_KeyProc

Func OnAutoItExit()
    DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hHook[0])
    DllCallbackFree($hStub_KeyProc)
EndFunc   ;==>OnAutoItExit
Edited by SkellySoul
Link to comment
Share on other sites

Before providing any help could you just tell us, What is the aim of the script?

There might be easier solutions..

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Before providing any help could you just tell us, What is the aim of the script?

There might be easier solutions..

I recently became a volunteer at a program called "Computer for Kids" and they want to help kids with their typing skills. There are more students than volunteers and it's hard to help everyone at times so my goal is to code something like this http://www.typingweb.com/

Unfortnately there is no internet access for reasons unkown but the computers are linked together so I thought maybe I could also make it collect everyones scores and we would see who needs the most help.

[edited]

I realize this will be a huge project and will take a considerate amount of time to complete but I am dedicated to getting a system like this in action. I also realize their might already be programs like this that exist but id really like to make my own.

Edited by SkellySoul
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...