01-07-2026, 01:59 AM
Well I'd like to eventually get one that will post without any problems on this forum, so I haven't added numlock to this routine, but before I do, let's test it out...
I also discovered Ctrl + Shift with then numbers 2, 6, and - key return values!
Pete
PS Rho should like this one, it's DATA lists... YUCK!
Code: (Select All)
Do
_Limit 30
b$ = InKey$
If _KeyDown(100303) Or _KeyDown(100304) Then shift = -1 Else If shift Then shift = 0
If _KeyDown(100305) Or _KeyDown(100306) Then ctrl = -1 Else If ctrl Then ctrl = 0
If _KeyDown(100307) Or _KeyDown(100308) Then alt = -1 Else If alt Then alt = 0
If Len(b$) Then
Sound 1000, .2
If alt Then
Restore AltKeys
ElseIf ctrl Then Restore CtrlKeys
ElseIf shift Then Restore UcaseKeys Else Restore LcaseKeys
End If
If Len(b$) = 1 Then e = Asc(b$): seed = 22 Else e = Asc(Mid$(b$, 2, 1)): seed = 0
i = 0
Do
i = i + 1
Read a, key$
If key$ = "eof" Then Exit Do
If a = e And i > seed Then
If shift Then
j = InStr("`1234567890-=[]\;',./", key$)
If j Then key$ = Mid$("~!@#$%^&*()_+{}|:'<>?", j, 1): If key$ = "'" Then key$ = Chr$(34)
End If
If key$ = "-Q" Then key$ = Chr$(34) ' Compensate for inability to store a quote mark in a data statement.
If shift + ctrl + alt Then If Len(key$) = 1 Then key$ = UCase$(key$)
If shift Then Print "Shift ";
If ctrl Then Print "Ctrl "; Rem If key$ = "J" Then key$ = "Enter" GLUT error. BTW _Keyhit would return 13 for Ctrl + Enter or Ctrl + J.
If alt Then Print "Alt ";
Print key$: Exit Do
End If
Loop
End If
Loop
UcaseKeys:
Data 84,F1,85,F2,86,F3,87,F4,88,F5,89,F6,90,F7,91,F8,92,F9,93,F10,133,F11,134,F12,82,Insert,83,Delete,73,PgUp,81,PgDn,71,Home,79,End,75,Arrow Lt,72,Arrow Up,80,Arrow Dn,77,Arrow Rt,8,Backspace,126,~,33,!,64,@,35,#,36,$,37,%,94,^,38,&,42,*,40,(,41,),95,_,43,+,81,Q,87,W,69,E,82,R,84,T,89,Y,85,U,73,I,79,O,80,P,123,{,125,},124,|,65,A,83,S,68,D,70,F,71,G,72,H,74,J,75,K,76,L,58,":",34,-Q,90,Z,88,X,67,C,86,V,66,B,78,N,77,M,60,<,62,>,63,?,32,Space,15,Tab,27,Esc,13,Enter,-1,eof
LcaseKeys:
Data 59,F1,60,F2,61,F3,62,F4,63,F5,64,F6,65,F7,66,F8,67,F9,68,F10,133,F11,134,F12,82,Insert,83,Delete,73,PgUp,81,PgDn,71,Home,79,End,75,Arrow Lt,72,Arrow Up,80,Arrow Dn,77,Arrow Rt,8,Backspace,96,`,49,1,50,2,51,3,52,4,53,5,54,6,55,7,56,8,57,9,48,0,45,-,61,=,113,q,119,w,101,e,114,r,116,t,121,y,117,u,105,i,111,o,112,p,91,[,93,],92,\,97,a,115,s,100,d,102,f,103,g,104,h,106,j,107,k,108,l,59,;,39,',122,z,120,x,99,c,118,v,98,b,110,n,109,m,44,",",46,.,47,/,32,Space,9,Tab,27,Esc,13,Enter,-1,eof
CtrlKeys:
Data 94,F1,95,F2,96,F3,97,F4,98,F5,99,F6,100,F7,101,F8,102,F9,103,F10,137,F11,138,F12,146,Insert,147,Delete,132,PgDp,118,PgDn,119,Home,117,End,115,Arrow Lt,141,Arrow Up,145,Arrow Dn,116,Arrow Rt,147,Backspace,17,q,23,w,5,e,18,r,20,t,25,y,21,u,9,i,15,o,16,p,1,a,19,s,4,d,6,f,7,g,8,h,10,j,11,k,12,l,26,z,24,x,3,c,22,v,2,b,14,n,13,m,32,Space,0,2,30,6,31,-,-1,eof
AltKeys:
Data 104,F1,105,F2,106,F3,108,F5,109,F6,110,F7,111,F8,112,F9,113,F10,139,F11,140,F12,162,Insert,163,Delete,153,PgDp,161,PgDn,151,Home,159,End,155,Arrow Lt,152,Arrow Up,160,Arrow Dn,157,Arrow Rt,14,Backspace,41,`,120,1,121,2,122,3,123,4,124,5,125,6,126,7,127,8,128,9,129,0,130,-,131,=,16,q,17,w,18,e,19,r,20,t,21,y,22,u,23,i,24,o,25,p,26,[,27,],43,\,30,a,31,s,32,d,33,f,34,g,35,h,36,j,37,k,38,l,39,;,40,',44,z,45,x,46,c,47,v,48,b,49,n,50,m,51,",",52,.,53,/,-1,eof
I also discovered Ctrl + Shift with then numbers 2, 6, and - key return values!
Pete
PS Rho should like this one, it's DATA lists... YUCK!

