01-06-2026, 10:00 PM
Well I think I will test the Export Code, and not edit this post.
Code: (Select All)
Type KeyPress
Press As String
shift As Integer
ctrl As Integer
alt As Integer
End Type
Dim k As KeyPress
KbUName$ = "f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 insert delete pgup pgdn home end arrow lt arrow up arrow dn arrow rt backspace ~ ! @ # $ % ^ & * ( ) _ + q w e r t y u i o p { } | a s d f g h j k l : " + Chr$(34) + " z x c v b n m < > ? space tab esc enter"
KbLName$ = "f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 insert delete pgup pgdn home end arrow lt arrow up arrow dn arrow rt backspace ` 1 2 3 4 5 6 7 8 9 0 - = q w e r t y u i o p [ ] \ a s d f g h j k l ; ' z x c v b n m , . / space tab esc enter"
KbU$ = ",84 ,85 ,86 ,87 ,88 ,89 ,90 ,91 ,92 ,93 ,133,134,82 ,83 ,73 ,81 ,71 ,79 ,75 ,72 ,80 ,77 ,8 ,126,33 ,64 ,35 ,36 ,37 ,94 ,38 ,42 ,40 ,41 ,95 ,43 ,81 ,87 ,69 ,82 ,84 ,89 ,85 ,73 ,79 ,80 ,123,125,124,65 ,83 ,68 ,70 ,71 ,72 ,74 ,75 ,76 ,58 ,34 ,90 ,88 ,67 ,86 ,66 ,78 ,77 ,60 ,62 ,63 ,32 ,15 ,27 ,13 "
KbL$ = ",59 ,60 ,61 ,62 ,63 ,64 ,65 ,66 ,67 ,68 ,133,134,82 ,83 ,73 ,81 ,71 ,79 ,75 ,72 ,80 ,77 ,8 ,96 ,49 ,50 ,51 ,52 ,53 ,54 ,55 ,56 ,57 ,48 ,45 ,61 ,113,119,101,114,116,121,117,105,111,112,91 ,93 ,92 ,97 ,115,100,102,103,104,106,107,108,59 ,39 ,122,120,99 ,118,98 ,110,109,44 ,46 ,47 ,32 ,9 ,27 ,13 "
Ctrlk$ = ",94 ,95 ,96 ,97 ,98 ,99 ,100,101,102,103,137,138,146,147,132,118,119,117,115,141,145,116,147,000,000,000,000,000,000,000,000,000,000,000,000,000,17 ,23 ,5 ,18 ,20 ,25 ,21 ,9 ,15 ,16 ,27 ,29 ,28 ,1 ,19 ,4 ,6 ,7 ,8 ,10 ,11 ,12 ,000,000,26 ,24 ,3 ,22 ,2 ,14 ,13 "
Altk$ = ",104,105,106,107,108,109,110,111,112,113,139,140,162,163,153,161,151,159,155,152,160,157,14 ,41 ,120,121,122,123,124,125,126,127,128,129,130,131,16 ,17 ,18 ,19 ,20 ,21 ,22 ,23 ,24 ,25 ,26 ,27 ,43 ,30 ,31 ,32 ,33 ,34 ,35 ,36 ,37 ,38 ,39 ,40 ,44 ,45 ,46 ,47 ,48 ,49 ,50 ,51 ,52 ,53 "
Do
_Limit 30
Keyboard k
If Len(k.Press) Then
e$ = Space$(3)
If k.ctrl = _TRUE And k.alt = _TRUE Or k.alt Then
Mid$(e$, 1) = LTrim$(Str$(Asc(Mid$(k.Press, 2, 1))))
e$ = RTrim$(Mid$(KbLName$, (((InStr(Altk$, "," + e$)) + 3) \ 4) * 10 - 9, 10))
ElseIf k.ctrl Then
If Len(k.Press) = 1 Then Mid$(e$, 1) = LTrim$(Str$(Asc(k.Press))) Else Mid$(e$, 1) = LTrim$(Str$(Asc(Mid$(k.Press, 2, 1))))
e$ = RTrim$(Mid$(KbLName$, (((InStr(Ctrlk$, "," + e$)) + 3) \ 4) * 10 - 9, 10))
Else
If Len(k.Press) = 1 Then Mid$(e$, 1) = LTrim$(Str$(Asc(k.Press))): seed = 89 Else Mid$(e$, 1) = LTrim$(Str$(Asc(Mid$(k.Press, 2, 1)))): seed = 0
If k.shift Then tmp1$ = KbUName$: tmp2$ = KbU$ Else tmp1$ = KbLName$: tmp2$ = KbL$
e$ = RTrim$(Mid$(tmp1$, (((InStr(seed, tmp2$, "," + e$)) + 3) \ 4) * 10 - 9, 10))
End If
End If
If Len(e$) Then
Print "Keypress: ";
If k.shift Then Print "Shift ";
If k.alt Then Print "Alt ";
If k.ctrl Then Print "Ctrl ";
If Len(e$) > 1 Then
Print UCase$(Left$(e$, 1)) + Mid$(e$, 2)
Else
If k.shift Or k.alt Or k.ctrl Then Print UCase$(e$) Else Print e$
End If
e$ = ""
End If
Loop
Sub Keyboard (k As KeyPress)
k.Press = InKey$
If _KeyDown(100303) Or _KeyDown(100304) Then k.shift = -1 Else If k.shift Then k.shift = 0
If _KeyDown(100305) Or _KeyDown(100306) Then k.ctrl = -1 Else If k.ctrl Then k.ctrl = 0
If _KeyDown(100307) Or _KeyDown(100308) Then k.alt = -1 Else If k.alt Then k.alt = 0
End Sub

