Jump to content

Right Shift Performong Caps Lock?


Recommended Posts

I found this code from an old post and it's working good except for one thing. When I use the RIGHT SHIFT key it act like the Caps Lock is on even after the RIGHTSHIFT is released and the only way to disable it is to hit the CAPS LOCK (which turns the caps lock light on but its really not on at this point) o hit the Left Shift which then finally kills the Caps Lock mode that the Right Shift caused. TIA for any advise around this or why it's happening. I commented out the Soundplay lines for testing purposes as you wont have those waves......Dennis

; Lowercase letters
; Lowercase letters
HotKeySet("a", "a")
HotKeySet("b", "b")
HotKeySet("c", "c")
HotKeySet("d", "d")
HotKeySet("e", "e")
HotKeySet("f", "f")
HotKeySet("g", "g")
HotKeySet("h", "h")
HotKeySet("i", "i")
HotKeySet("j", "j")
HotKeySet("k", "k")
HotKeySet("l", "l")
HotKeySet("m", "m")
HotKeySet("n", "n")
HotKeySet("o", "o")
HotKeySet("p", "p")
HotKeySet("q", "q")
HotKeySet("r", "r")
HotKeySet("s", "s")
HotKeySet("t", "t")
HotKeySet("u", "u")
HotKeySet("v", "v")
HotKeySet("w", "w")
HotKeySet("x", "x")
HotKeySet("y", "y")
HotKeySet("z", "z")

; Uppercase letters
; Function names are not case-sensitive, so double letter names are required.

HotKeySet("+a", "AA")
HotKeySet("+b", "BB")
HotKeySet("+c", "CC")
HotKeySet("+d", "DD")
HotKeySet("+e", "EE")
HotKeySet("+f", "FF")
HotKeySet("+g", "GG")
HotKeySet("+h", "HH")
HotKeySet("+i", "II")
HotKeySet("+j", "JJ")
HotKeySet("+k", "KK")
HotKeySet("+l", "LL")
HotKeySet("+m", "MM")
HotKeySet("+n", "NN")
HotKeySet("+o", "OO")
HotKeySet("+p", "PP")
HotKeySet("+q", "QQ")
HotKeySet("+r", "RR")
HotKeySet("+s", "SS")
HotKeySet("+t", "TT")
HotKeySet("+u", "UU")
HotKeySet("+v", "VV")
HotKeySet("+w", "WW")
HotKeySet("+x", "XX")
HotKeySet("+y", "YY")
HotKeySet("+z", "ZZ")

; Numbers and period
; Function names can't start with a numeral, so use an "x" before the numeral.

HotKeySet("0", "x0")
HotKeySet("1", "x1")
HotKeySet("2", "x2")
HotKeySet("3", "x3")
HotKeySet("4", "x4")
HotKeySet("5", "x5")
HotKeySet("6", "x6")
HotKeySet("7", "x7")
HotKeySet("8", "x8")
HotKeySet("9", "x9")
HotKeySet(".", "period")

; Do nothing but sleep while processing hotkeys that are typed in other applications.
While 1
    Sleep(100)
WEnd

; The rest of this script consists of all the functions 
; that are called by the hotkeys.

; Lowercase letters

Func a()
   ;SoundPlay("c:\sounds\a.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("a")
    Send("a")
; turn hotkey back on
    HotKeySet("a", "a")
EndFunc

Func b()
   ;SoundPlay("c:\sounds\b.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("b")
    Send("b")
; turn hotkey back on
    HotKeySet("b", "b")
EndFunc

Func c()
   ;SoundPlay("c:\sounds\c.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("c")
    Send("c")
; turn hotkey back on
    HotKeySet("c", "c")
EndFunc

Func d()
   ;SoundPlay("c:\sounds\d.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("d")
    Send("d")
; turn hotkey back on
    HotKeySet("d", "d")
EndFunc

Func e()
   ;SoundPlay("c:\sounds\e.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("e")
    Send("e")
; turn hotkey back on
    HotKeySet("e", "e")
EndFunc

Func f()
   ;SoundPlay("c:\sounds\f.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("f")
    Send("f")
; turn hotkey back on
    HotKeySet("f", "f")
EndFunc

Func g()
   ;SoundPlay("c:\sounds\g.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("g")
    Send("g")
; turn hotkey back on
    HotKeySet("g", "g")
EndFunc

Func h()
   ;SoundPlay("c:\sounds\h.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("h")
    Send("h")
; turn hotkey back on
    HotKeySet("h", "h")
EndFunc

Func i()
   ;SoundPlay("c:\sounds\i.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("i")
    Send("i")
; turn hotkey back on
    HotKeySet("i", "i")
EndFunc

Func j()
   ;SoundPlay("c:\sounds\j.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("j")
    Send("j")
; turn hotkey back on
    HotKeySet("j", "j")
EndFunc

Func k()
   ;SoundPlay("c:\sounds\k.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("k")
    Send("k")
; turn hotkey back on
    HotKeySet("k", "k")
EndFunc

Func l()
   ;SoundPlay("c:\sounds\l.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("l")
    Send("l")
; turn hotkey back on
    HotKeySet("l", "l")
EndFunc

Func m()
   ;SoundPlay("c:\sounds\m.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("m")
    Send("m")
; turn hotkey back on
    HotKeySet("m", "m")
EndFunc

Func n()
   ;SoundPlay("c:\sounds\n.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("n")
    Send("n")
; turn hotkey back on
    HotKeySet("n", "n")
EndFunc

Func o()
   ;SoundPlay("c:\sounds\o.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("o")
    Send("o")
; turn hotkey back on
    HotKeySet("o", "o")
EndFunc

Func p()
   ;SoundPlay("c:\sounds\p.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("p")
    Send("p")
; turn hotkey back on
    HotKeySet("p", "p")
EndFunc

Func q()
   ;SoundPlay("c:\sounds\q.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("q")
    Send("q")
; turn hotkey back on
    HotKeySet("q", "q")
EndFunc

Func r()
   ;SoundPlay("c:\sounds\r.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("r")
    Send("r")
; turn hotkey back on
    HotKeySet("r", "r")
EndFunc

Func s()
   ;SoundPlay("c:\sounds\s.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("s")
    Send("s")
; turn hotkey back on
    HotKeySet("s", "s")
EndFunc

Func t()
   ;SoundPlay("c:\sounds\t.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("t")
    Send("t")
; turn hotkey back on
    HotKeySet("t", "t")
EndFunc

Func u()
   ;SoundPlay("c:\sounds\u.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("u")
    Send("u")
; turn hotkey back on
    HotKeySet("u", "u")
EndFunc

Func v()
   ;SoundPlay("c:\sounds\v.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("v")
    Send("v")
; turn hotkey back on
    HotKeySet("v", "v")
EndFunc

Func w()
   ;SoundPlay("c:\sounds\w.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("w")
    Send("w")
; turn hotkey back on
    HotKeySet("w", "w")
EndFunc

Func x()
   ;SoundPlay("c:\sounds\x.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("x")
    Send("x")
; turn hotkey back on
    HotKeySet("x", "x")
EndFunc

Func y()
   ;SoundPlay("c:\sounds\y.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("y")
    Send("y")
; turn hotkey back on
    HotKeySet("y", "y")
EndFunc

Func z()
   ;SoundPlay("c:\sounds\z.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("z")
    Send("z")
; turn hotkey back on
    HotKeySet("z", "z")
EndFunc


; Uppercase letters


Func AA()
   ;SoundPlay("C:\sounds\AA.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+a")
    Send("+a")
; turn hotkey back on
    HotKeySet("+a", "AA")
EndFunc

Func BB()
   ;SoundPlay("C:\sounds\BB.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+b")
    Send("+b")
; turn hotkey back on
    HotKeySet("+b", "BB")
EndFunc

Func CC()
   ;SoundPlay("C:\sounds\CC.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+c")
    Send("+c")
; turn hotkey back on
    HotKeySet("+c", "CC")
EndFunc

Func DD()
   ;SoundPlay("C:\sounds\DD.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+d")
    Send("+d")
; turn hotkey back on
    HotKeySet("+d", "DD")
EndFunc

Func EE()
   ;SoundPlay("C:\sounds\EE.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+e")
    Send("+e")
; turn hotkey back on
    HotKeySet("+e", "EE")
EndFunc

Func FF()
   ;SoundPlay("C:\sounds\FF.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+f")
    Send("+f")
; turn hotkey back on
    HotKeySet("+f", "FF")
EndFunc

Func GG()
   ;SoundPlay("C:\sounds\GG.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+g")
    Send("+g")
; turn hotkey back on
    HotKeySet("+g", "GG")
EndFunc

Func HH()
   ;SoundPlay("C:\sounds\HH.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+h")
    Send("+h")
; turn hotkey back on
    HotKeySet("+h", "HH")
EndFunc

Func II()
   ;SoundPlay("C:\sounds\II.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+i")
    Send("+i")
; turn hotkey back on
    HotKeySet("+i", "II")
EndFunc

Func JJ()
   ;SoundPlay("C:\sounds\JJ.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+j")
    Send("+j")
; turn hotkey back on
    HotKeySet("+j", "JJ")
EndFunc

Func KK()
   ;SoundPlay("C:\sounds\KK.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+k")
    Send("+k")
; turn hotkey back on
    HotKeySet("+k", "KK")
EndFunc

Func LL()
   ;SoundPlay("C:\sounds\LL.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+l")
    Send("+l")
; turn hotkey back on
    HotKeySet("+l", "LL")
EndFunc

Func MM()
   ;SoundPlay("C:\sounds\MM.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+m")
    Send("+m")
; turn hotkey back on
    HotKeySet("+m", "MM")
EndFunc

Func NN()
   ;SoundPlay("C:\sounds\NN.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+n")
    Send("+n")
; turn hotkey back on
    HotKeySet("+n", "NN")
EndFunc

Func OO()
   ;SoundPlay("C:\sounds\OO.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+o")
    Send("+o")
; turn hotkey back on
    HotKeySet("+o", "OO")
EndFunc

Func PP()
   ;SoundPlay("C:\sounds\PP.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+p")
    Send("+p")
; turn hotkey back on
    HotKeySet("+p", "PP")
EndFunc

Func QQ()
   ;SoundPlay("C:\sounds\QQ.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+q")
    Send("+q")
; turn hotkey back on
    HotKeySet("+q", "QQ")
EndFunc

Func RR()
   ;SoundPlay("C:\sounds\RR.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+r")
    Send("+r")
; turn hotkey back on
    HotKeySet("+r", "RR")
EndFunc

Func SS()
   ;SoundPlay("C:\sounds\SS.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+s")
    Send("+s")
; turn hotkey back on
    HotKeySet("+s", "SS")
EndFunc

Func TT()
   ;SoundPlay("C:\sounds\TT.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+t")
    Send("+t")
; turn hotkey back on
    HotKeySet("+t", "TT")
EndFunc

Func UU()
   ;SoundPlay("C:\sounds\UU.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+u")
    Send("+u")
; turn hotkey back on
    HotKeySet("+u", "UU")
EndFunc

Func VV()
   ;SoundPlay("C:\sounds\VV.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+v")
    Send("+v")
; turn hotkey back on
    HotKeySet("+v", "VV")
EndFunc

Func WW()
   ;SoundPlay("C:\sounds\WW.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+w")
    Send("+w")
; turn hotkey back on
    HotKeySet("+w", "WW")
EndFunc

Func XX()
   ;SoundPlay("C:\sounds\XX.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+x")
    Send("+x")
; turn hotkey back on
    HotKeySet("+x", "XX")
EndFunc

Func YY()
   ;SoundPlay("C:\sounds\YY.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+y")
    Send("+y")
; turn hotkey back on
    HotKeySet("+y", "YY")
EndFunc

Func ZZ()
   ;SoundPlay("C:\sounds\ZZ.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("+z")
    Send("+z")
; turn hotkey back on
    HotKeySet("+z", "ZZ")
EndFunc


; Numerals


Func x0()
   ;SoundPlay("c:\sounds\0.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("0")
    Send("0")
; turn hotkey back on
    HotKeySet("0", "x0")
EndFunc

Func x1()
   ;SoundPlay("c:\sounds\1.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("1")
    Send("1")
; turn hotkey back on
    HotKeySet("1", "x1")
EndFunc

Func x2()
   ;SoundPlay("c:\sounds\2.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("2")
    Send("2")
; turn hotkey back on
    HotKeySet("2", "x2")
EndFunc

Func x3()
   ;SoundPlay("c:\sounds\3.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("3")
    Send("3")
; turn hotkey back on
    HotKeySet("3", "x3")
EndFunc

Func x4()
   ;SoundPlay("c:\sounds\4.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("4")
    Send("4")
; turn hotkey back on
    HotKeySet("4", "x4")
EndFunc

Func x5()
   ;SoundPlay("c:\sounds\5.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("5")
    Send("5")
; turn hotkey back on
    HotKeySet("5", "x5")
EndFunc

Func x6()
   ;SoundPlay("c:\sounds\6.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("6")
    Send("6")
; turn hotkey back on
    HotKeySet("6", "x6")
EndFunc

Func x7()
   ;SoundPlay("c:\sounds\7.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("7")
    Send("7")
; turn hotkey back on
    HotKeySet("7", "x7")
EndFunc

Func x8()
   ;SoundPlay("c:\sounds\8.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("8")
    Send("8")
; turn hotkey back on
    HotKeySet("8", "x8")
EndFunc

Func x9()
   ;SoundPlay("c:\sounds\9.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet("9")
    Send("9")
; turn hotkey back on
    HotKeySet("9", "x9")
EndFunc

Func period()
   ;SoundPlay("c:\sounds\period.wav")
; Turn off hotkey temporarily so letter can be sent.
    HotKeySet(".")
    Send(".")
; turn hotkey back on
    HotKeySet(".", "period")
EndFunc
Link to comment
Share on other sites

Who knows. Maybe one of the hotkeys have been made wrong.

I looked thru it very complete James. It's only letters and Numbers and a Period that are set and they all are correct. I've just been stuck why the Right shift would behave this way and the Left Shift Works fine.

DDennis

Link to comment
Share on other sites

This now works exactly as i expected, its about 1000 lines shorter too.

;Capital Letters
For $n = 65 To 90
    HotKeySet(Chr($n), "My_HotKey_Func")
Next
;Lowercase Letters
For $n = 97 To 122
    HotKeySet(Chr($n), "My_HotKey_Func")
Next
;Numbers
For $n = 47 To 58
    HotKeySet(Chr($n), "My_HotKey_Func")
Next

HotkeySet(".", "My_Hotkey_Func")

;Specials
;$KeyList = StringSplit("{SPACE}|{BACKSPACE}|{UP}|{DOWN}|{LEFT}|{RIGHT}|{ENTER}|{HOME}|{END}|{INSERT}|{DELETE}|{PGUP}|{PGDN}|{!}|{#}|{+}|{^}", "|")
;For $n = 1 To $KeyList[0]
;   HotKeySet($KeyList[$n], "MY_HotKey_Func")
;Next


While 1
    Sleep(100)
WEnd

Func My_HotKey_Func()
    ;MsgBox(0, "", @HotKeyPressed)
    $Name = @HotkeyPressed
       If $Name = "." then $Name = "period"

       ;SoundPlay("c:\sounds\"&$Name&".wav") ; exceptions for keys like period slash or symobols that can't be in filenames
    ; Turn off hotkey temporarily so letter can be sent.
    HotKeySet(@HotKeyPressed)
    Send(@HotKeyPressed)
    ; turn hotkey back on
    HotKeySet(@HotKeyPressed, "My_HotKey_Func")
EndFunc   ;==>My_HotKey_Func
Edited by Paulie
Link to comment
Share on other sites

This now works exactly as i expected, its about 1000 lines shorter too.

;Capital Letters
For $n = 65 To 90
    HotKeySet(Chr($n), "My_HotKey_Func")
Next
;Lowercase Letters
For $n = 97 To 122
    HotKeySet(Chr($n), "My_HotKey_Func")
Next
;Numbers
For $n = 47 To 58
    HotKeySet(Chr($n), "My_HotKey_Func")
Next

HotkeySet(".", "My_Hotkey_Func")

;Specials
;$KeyList = StringSplit("{SPACE}|{BACKSPACE}|{UP}|{DOWN}|{LEFT}|{RIGHT}|{ENTER}|{HOME}|{END}|{INSERT}|{DELETE}|{PGUP}|{PGDN}|{!}|{#}|{+}|{^}", "|")
;For $n = 1 To $KeyList[0]
;   HotKeySet($KeyList[$n], "MY_HotKey_Func")
;Next


While 1
    Sleep(100)
WEnd

Func My_HotKey_Func()
    ;MsgBox(0, "", @HotKeyPressed)
    $Name = @HotkeyPressed
       If $Name = "." then $Name = "period"

       ;SoundPlay("c:\sounds\"&$Name&".wav") ; exceptions for keys like period slash or symobols that can't be in filenames
    ; Turn off hotkey temporarily so letter can be sent.
    HotKeySet(@HotKeyPressed)
    Send(@HotKeyPressed)
    ; turn hotkey back on
    HotKeySet(@HotKeyPressed, "My_HotKey_Func")
EndFunc   ;==>My_HotKey_Func
That is Great!!!! Thanks Paulie. Does your Caps Lock return uppercase when its on though during this script?

Dennis

Link to comment
Share on other sites

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...