Jump to content

Strange "bug"


Recommended Posts

#include <GUIConstants.au3>

GUICreate("Hangul Typer",150,150)
$lblChar1 = GUICtrlCreateLabel("",5,10,20,20)
$lblChar2 = GUICtrlCreateLabel("",25,10,20,20)
$lblChar3 = GUICtrlCreateLabel("",45,10,20,20)
$lblChar4 = GUICtrlCreateLabel("",65,0,20,20)
GUICtrlSetFont(-1,16)
$lblChar5 = GUICtrlCreateLabel("",95,10,20,20)
$lblChar6 = GUICtrlCreateLabel("",115,10,20,20)
$lblChar7 = GUICtrlCreateLabel("",135,10,20,20)
$iptChar = GUICtrlCreateInput("",55,35,40,20,$ES_CENTER)
$lblCS = GUICtrlCreateLabel("Consonant Sets",5,70,140,25,$ES_CENTER)
$cbxCS1 = GUICtrlCreateCheckbox("1",5,85)
GUICtrlSetState(-1,$GUI_CHECKED)
$cbxCS2 = GUICtrlCreateCheckbox("2",40,85)
$cbxCS3 = GUICtrlCreateCheckbox("3",75,85)
$cbxCS4 = GUICtrlCreateCheckbox("4",115,85)
$lvlVS = GUICtrlCreateLabel("Vowel Sets",5,110,140,25,$ES_CENTER)
$cbxVS1 = GUICtrlCreateCheckbox("1",5,125)
$cbxVS2 = GUICtrlCreateCheckbox("2",40,125)
$cbxVS3 = GUICtrlCreateCheckbox("3",75,125)
$cbxVS4 = GUICtrlCreateCheckbox("4",115,125)
GUISetState()

#region Hangul Array
Dim $Hang[33]
$Hang[0] = "ㅂ"
$Hang[1] = "ㅈ"
$Hang[2] = "ㄷ"
$Hang[3] = "ㄱ"
$Hang[4] = "ㅅ"
$Hang[5] = "ㅃ"
$Hang[6] = "ㅉ"
$Hang[7] = "ㄸ"
$Hang[8] = "ㄲ"
$Hang[9] = "ㅆ"
$Hang[10] = "ㅍ"
$Hang[11] = "ㅊ"
$Hang[12] = "ㅌ"
$Hang[13] = "ㅋ"
$Hang[14] = "ㅁ"
$Hang[15] = "ㄴ"
$Hang[16] = "ㅇ"
$Hang[17] = "ㄹ"
$Hang[18] = "ㅎ"
$Hang[19] = "ㅗ"
$Hang[20] = "ㅓ"
$Hang[21] = "ㅏ"
$Hang[22] = "ㅣ"
$Hang[23] = "ㅛ"
$Hang[24] = "ㅕ"
$Hang[25] = "ㅑ"
$Hang[26] = "ㅐ"
$Hang[27] = "ㅔ"
$Hang[28] = "ㅒ"
$Hang[29] = "ㅖ"
$Hang[30] = "ㅜ"
$Hang[31] = "ㅠ"
$Hang[32] = "ㅡ"
#endregion
#endregion

New()
New()
New()
New()
New()
New()
New()
$Old = ""

Do
    $msg = GUIGetMsg()
    
    If Full() Then
        If Check() Then 
            New()
        Else
            Clear()
        EndIf
    EndIf
Until $msg == $GUI_EVENT_CLOSE

Func New()
    GUICtrlSetData($lblChar1,GUICtrlRead($lblChar2))
    GUICtrlSetData($lblChar2,GUICtrlRead($lblChar3))
    GUICtrlSetData($lblChar3,GUICtrlRead($lblChar4))
    GUICtrlSetData($lblChar4,GUICtrlRead($lblChar5))
    GUICtrlSetData($lblChar5,GUICtrlRead($lblChar6))
    GUICtrlSetData($lblChar6,GUICtrlRead($lblChar7))
    GUICtrlSetData($lblChar7,$Hang[Item()])
EndFunc

Func Item()
    Do
        $pass = True
        $r = Random(0,32,1)
        If $Hang[$r] == GUICtrlRead($lblChar6) Then $pass = False
        If $r >= 00 And $r <= 04 And GUICtrlRead($cbxCS1) == $GUI_UNCHECKED Then $pass = False
        If $r >= 05 And $r <= 09 And GUICtrlRead($cbxCS2) == $GUI_UNCHECKED Then $pass = False
        If $r >= 10 And $r <= 13 And GUICtrlRead($cbxCS3) == $GUI_UNCHECKED Then $pass = False
        If $r >= 14 And $r <= 18 And GUICtrlRead($cbxCS4) == $GUI_UNCHECKED Then $pass = False
        If $r >= 19 And $r <= 22 And GUICtrlRead($cbxVS1) == $GUI_UNCHECKED Then $pass = False
        If $r >= 23 And $r <= 25 And GUICtrlRead($cbxVS2) == $GUI_UNCHECKED Then $pass = False
        If $r >= 26 And $r <= 29 And GUICtrlRead($cbxVS3) == $GUI_UNCHECKED Then $pass = False
        If $r >= 30 And $r <= 32 And GUICtrlRead($cbxVS4) == $GUI_UNCHECKED Then $pass = False
    Until $pass
    Return $r
EndFunc

Func Check()
    Return (GUICtrlRead($lblChar4) == GUICtrlRead($iptChar))
EndFunc

Func Full()
    Return (GUICtrlRead($iptChar) <> "")
EndFunc

Func Clear()
    Send("{SPACE}")
    GUICtrlSetData($iptChar,"")
EndFunc

Above is some the code to a program I made to help myself learn to type Hangeul.

Attached is the uncompiled script.

The problem is that whenever I type "shift+[any key]" into this program(the input specifically), my computer acts as if I'm still holding shift down. It does this even after I have exited the program.

However when I press the left shift, it sometimes fixes this problem. I've tried "Send("{LSHIFT}")" to have the problem fix itself, but that doesn't seem to work.

Also, this problem only seems to happen if I press "alt+shift" (to change language inputs.)

Lastly, I DON'T have sticky keys enabled, so that isn't it.

So, I'm unsure if this is a coding problem, a windows problem, or a language bar problem.

Either way, does anyone have any ideas to fixing this problem?

HangulTyper.au3

Edited by PCode
Link to comment
Share on other sites

Try searching the forum about it, there seems to be a lot of issues regarding modifier keys getting stuck on different conditions..

Thanks, I did this.

I found this post

So then what I tried was making it wait until the shift key was released to send anything.

Func Clear()
    While _IsPressed("10")
        Sleep(100)
    WEnd
    Send("{SPACE}")
    GUICtrlSetData($iptChar,"")
EndFunc

This way it avoided the shift being pressed during the send command.

Anyway, hopefully someone who has the same mistake finds this topic.

Thanks again.

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