View previous topic :: View next topic |
Author |
Message |
marcelo Contributor
Joined: 10 May 2008 Posts: 145
|
Posted: Fri Oct 25, 2024 2:49 pm Post subject: Backspace Key |
|
|
Hi to all.
Question:
Is there a way to detect the "backspace" key.
Something like
Code: |
Hotkey add,1,Backspace
|
Thanks a lot in advance
Marcelo
|
|
Back to top |
|
|
vtol Valued Contributor
Joined: 05 Feb 2004 Posts: 648 Location: Eastern Indiana
|
Posted: Wed Nov 13, 2024 3:59 am Post subject: |
|
|
I was using API to do it but cant find it.
I did find this online:
VK_BACK 0x08 BACKSPACE key
All I can find right now is couple number keys possible examples:
LOADLIB USER32
rem %%num0 = @lib(user32,GetAsyncKeyState,int:,VK_NUMPAD0 & 0x60)
%%num0 = @lib(user32,GetAsyncKeyState,int:,$060)
%%ALT3 = @lib(user32,GetAsyncKeyState,int:,$33)
FREELIB USER32
Maybe this is enough to get you rolling - sorry I can't find my full scrips.
cheers
|
|
Back to top |
|
|
marcelo Contributor
Joined: 10 May 2008 Posts: 145
|
Posted: Tue Nov 19, 2024 1:19 pm Post subject: |
|
|
Thank you so much!
I'll try to figure out how to implement that...
|
|
Back to top |
|
|
vtol Valued Contributor
Joined: 05 Feb 2004 Posts: 648 Location: Eastern Indiana
|
Posted: Tue Nov 19, 2024 3:46 pm Post subject: |
|
|
Your very welcome
Glad to help.. I remember it was like a short simple command line.
If you like I will have some spare time in a few days and could write the function, and that way I could document it for myself in case I need it too.
cheers
|
|
Back to top |
|
|
marcelo Contributor
Joined: 10 May 2008 Posts: 145
|
Posted: Tue Nov 19, 2024 3:50 pm Post subject: |
|
|
Uh. If you could that would be great. I have no experience in handling APIs.
Thanks a lot again!!
|
|
Back to top |
|
|
vtol Valued Contributor
Joined: 05 Feb 2004 Posts: 648 Location: Eastern Indiana
|
Posted: Tue Nov 19, 2024 4:04 pm Post subject: |
|
|
I'm not a pro at it but have wrote a few when I really needed them.
But they a very simple layouts once you get 1 running, its easy peasy.
Hopefully I'll have time today and write a really simple /small program demo of the Backspace PRESS detection.
Cheers
|
|
Back to top |
|
|
marcelo Contributor
Joined: 10 May 2008 Posts: 145
|
Posted: Wed Nov 20, 2024 7:02 pm Post subject: |
|
|
Yeah!! How nice to know that!! I'll be keeping an eye out for any updates.
|
|
Back to top |
|
|
vtol Valued Contributor
Joined: 05 Feb 2004 Posts: 648 Location: Eastern Indiana
|
Posted: Fri Nov 22, 2024 2:40 am Post subject: |
|
|
Hopefully this DEMO can help ya in some way:
detect Keyboard keys (API) 2024 DEMO
Code: |
REM ----------------------------------------
# API - partial keyboard key detection -DEMO
# Use at your own risk < > contains API code
# 11/21/24 vtol - This CODE is not completed
# There's some more keyboard keys out there
REM ----------------------------------------
OPTION SCALE, 96
OPTION DECIMALSEP,"."
%%TITLE = "Keyboard key Detection (API) 2024"
%%CLASS = "Keyboard-key-Detection-API-2024"
TITLE %%TITLE
IF @WinExists(#%%CLASS)
WINDOW ACTIVATE,#%%CLASS
goto close2
END
DIALOG CREATE,%%TITLE,-1,0,552,402,SAVEPOS,CLASS %%CLASS
DIALOG ADD,STYLE,STYLE1,Consolas,10,,,0|80|0
DIALOG ADD,STYLE,STYLE2,Calibri,12,,,0|0|170
DIALOG ADD,STYLE,STYLE3,Calibri,11,,,70|10|10
DIALOG ADD,STYLE,STYLE4,Calibri,11,b,,10|10|170
DIALOG ADD,STYLE,STYLE5,Calibri,11,b,,10|10|170
DIALOG ADD,STYLE,STYLE6,Calibri,10,,,70|10|10
DIALOG ADD,STYLE,STYLE7,Calibri,12,b,,0|0|170
DIALOG ADD,LIST,EDIT1,12,17,210,240,Edit1,,multi,STYLE2
DIALOG ADD,LIST,EDIT2,262,17,210,102,Edit2,,multi,STYLE1
DIALOG ADD,extTEXT,available,8,245,,,"NON-Number Keys:",,STYLE4
DIALOG ADD,LIST,keys,29,245,135,335,Key LIST,,multi,STYLE3
DIALOG ADD,extTEXT,available2,8,400,,,"Number Keys:",,STYLE5
DIALOG ADD,LIST,keys2,29,400,135,335,Key LIST,,multi,STYLE6
DIALOG ADD,BUTTON,clear,370,17,57,27,"CLEAR",,,HAND,STYLE7
DIALOG ADD,BUTTON,info,370,479,57,27,"HELP",,,HAND,STYLE7
LIST LOADTEXT,keys
"backspace
"Esc
"Left Arrow
"Right Arrow
"SpaceBar
"
"End
"Home
"ENTER
"Delete
"NumPad DEL .
"
"F1
"F2
"F3
"F4
"F5
"
LIST LOADTEXT,keys2
"0
"1
"2
"3
"4
"5
"6
"7
"8
"9
"
"NumPad 0
"NumPad 1
"NumPad 2
"NumPad 3
"NumPad 4
"NumPad 5
"NumPad 6
"NumPad 7
"NumPad 8
"NumPad 9
"
#==>
######################
DIALOG ADD,BUTTON,fake,1,1,0,0
DIALOG SHOW
DIALOG FOCUS,fake
######################
#==>
LOADLIB USER32
:evloop
# 0.09 seems BEST for GetAsyncKeyState:
WAIT EVENT,0.09
%E = @event()
IF %E
GOTO %E
END
GOTO evloop
:TIMER
%%ALT = 0
%%ALT2 = 0
%%ALT3 = 0
%%ALT4 = 0
%%ALT5 = 0
%%ALT6 = 0
%%ALT7 = 0
%%ALT8 = 0
%%ALT9 = 0
%%num0 = 0
%%num1 = 0
%%num2 = 0
%%num3 = 0
%%num4 = 0
%%num5 = 0
%%num6 = 0
%%num7 = 0
%%num8 = 0
%%num9 = 0
rem %%num0 = @lib(user32,GetAsyncKeyState,int:,VK_NUMPAD0 & 0x60)
%%num0 = @lib(user32,GetAsyncKeyState,int:,$060)
%%num1 = @lib(user32,GetAsyncKeyState,int:,$061)
%%num2 = @lib(user32,GetAsyncKeyState,int:,$062)
%%num3 = @lib(user32,GetAsyncKeyState,int:,$063)
%%num4 = @lib(user32,GetAsyncKeyState,int:,$064)
%%num5 = @lib(user32,GetAsyncKeyState,int:,$065)
%%num6 = @lib(user32,GetAsyncKeyState,int:,$066)
%%num7 = @lib(user32,GetAsyncKeyState,int:,$067)
%%num8 = @lib(user32,GetAsyncKeyState,int:,$068)
%%num9 = @lib(user32,GetAsyncKeyState,int:,$069)
# VK_BACK 0x08 BACKSPACE key
%%BACK = 0
%%BACK = @lib(user32,GetAsyncKeyState,int:,$008)
IF @NOT(@equal(%%BACK,0))
LIST insert,EDIT2,"backspace ==> "%%BACK
LIST insert,EDIT1,backspace
END
# VK_ESCAPE 0x1B Esc Key
%%ESC = 0
%%ESC = @lib(user32,GetAsyncKeyState,int:,$01B)
IF @NOT(@equal(%%ESC,0))
LIST insert,EDIT2,"ESC ==> "%%ESC
LIST insert,EDIT1,ESC
END
# VK_LEFT 0x25 Arrow Left
%%LeftArrow = 0
%%LeftArrow = @lib(user32,GetAsyncKeyState,int:,$025)
IF @NOT(@equal(%%LeftArrow,0))
LIST insert,EDIT2,"LeftArrow ==> "%%LeftArrow
LIST insert,EDIT1,LeftArrow
END
# VK_RIGHT 0x27 Arrow Right
%%RightArrow = 0
%%RightArrow = @lib(user32,GetAsyncKeyState,int:,$027)
IF @NOT(@equal(%%RightArrow,0))
LIST insert,EDIT2,"RightArrow ==> "%%RightArrow
LIST insert,EDIT1,RightArrow
END
# VK_SPACE 0x20 SpaceBar
%%SpaceBar = 0
%%SpaceBar = @lib(user32,GetAsyncKeyState,int:,$020)
IF @NOT(@equal(%%SpaceBar,0))
LIST insert,EDIT2,"SpaceBar ==> "%%SpaceBar
LIST insert,EDIT1,SpaceBar
END
# VK_END 0x23 End
%%END = 0
%%END = @lib(user32,GetAsyncKeyState,int:,$023)
IF @NOT(@equal(%%END,0))
LIST insert,EDIT2,"END ==> "%%END
LIST insert,EDIT1,END
END
# VK_HOME 0x24 Home
%%HOME = 0
%%HOME = @lib(user32,GetAsyncKeyState,int:,$024)
IF @NOT(@equal(%%HOME,0))
LIST insert,EDIT2,"HOME ==> "%%HOME
LIST insert,EDIT1,HOME
END
# VK_RETURN 0x0D Enter
%%ENTER = 0
%%ENTER = @lib(user32,GetAsyncKeyState,int:,$00D)
IF @NOT(@equal(%%ENTER,0))
LIST insert,EDIT2,"ENTER ==> "%%ENTER
LIST insert,EDIT1,ENTER
END
# VK_DELETE 0x2E Delete
%%DEL = 0
%%DEL = @lib(user32,GetAsyncKeyState,int:,$02E)
IF @NOT(@equal(%%DEL,0))
LIST insert,EDIT2,"DEL ==> "%%DEL
LIST insert,EDIT1,DEL
END
# VK_DECIMAL 0x6E Numpad .
%%NumPad_DEL = 0
%%NumPad_DEL = @lib(user32,GetAsyncKeyState,int:,$06E)
IF @NOT(@equal(%%NumPad_DEL,0))
LIST insert,EDIT2,"NumPad_DEL ==> "%%NumPad_DEL
LIST insert,EDIT1,"NumPad_DEL -or- Numpad ."
END
%%delay1 = "0.045"
# VK_F1 0x70 F1
%%F1 = 0
%%F1 = @lib(user32,GetAsyncKeyState,int:,$070)
IF @NOT(@equal(%%F1,0))
IF @NOT(@equal(%%F1,1))
LIST insert,EDIT2,"F1 ==> "%%F1
END
LIST insert,EDIT1,"F1"
WAIT %%delay1
END
# VK_F1 0x71 F2
%%F2 = 0
%%F2 = @lib(user32,GetAsyncKeyState,int:,$071)
IF @NOT(@equal(%%F2,0))
IF @NOT(@equal(%%F2,1))
LIST insert,EDIT2,"F3 ==> "%%F2
END
LIST insert,EDIT1,"F2"
WAIT %%delay1
END
# VK_F1 0x72 F3
%%F3 = 0
%%F3 = @lib(user32,GetAsyncKeyState,int:,$072)
IF @NOT(@equal(%%F3,0))
IF @NOT(@equal(%%F3,1))
LIST insert,EDIT2,"F3 ==> "%%F3
END
LIST insert,EDIT1,"F3"
WAIT %%delay1
END
# VK_F1 0x73 F4
%%F4 = 0
%%F4 = @lib(user32,GetAsyncKeyState,int:,$073)
IF @NOT(@equal(%%F4,0))
IF @NOT(@equal(%%F4,1))
LIST insert,EDIT2,"F4 ==> "%%F4
END
LIST insert,EDIT1,"F4"
WAIT %%delay1
END
# VK_F5 0x74 F5
%%F5 = 0
%%F5 = @lib(user32,GetAsyncKeyState,int:,$074)
IF @NOT(@equal(%%F5,0))
IF @NOT(@equal(%%F5,1))
LIST insert,EDIT2,"F5 ==> "%%F5
END
LIST insert,EDIT1,"F5"
WAIT %%delay1
END
IF @NOT(@equal(%%num0,0))
LIST insert,EDIT2,"Num0 ==> "%%num0
LIST insert,EDIT1,NumKey: 0
END
IF @NOT(@equal(%%num1,0))
LIST insert,EDIT2,"Num1 ==> "%%num1
LIST insert,EDIT1,NumKey: 1
END
IF @NOT(@equal(%%num2,0))
LIST insert,EDIT2,"Num2 ==> "%%num2
LIST insert,EDIT1,NumKey: 2
END
IF @NOT(@equal(%%num3,0))
LIST insert,EDIT2,"Num3 ==> "%%num3
LIST insert,EDIT1,NumKey: 3
END
IF @NOT(@equal(%%num4,0))
LIST insert,EDIT2,"Num4 ==> "%%num4
LIST insert,EDIT1,NumKey: 4
END
IF @NOT(@equal(%%num5,0))
LIST insert,EDIT2,"Num5 ==> "%%num5
LIST insert,EDIT1,NumKey: 5
END
IF @NOT(@equal(%%num6,0))
LIST insert,EDIT2,"Num6 ==> "%%num6
LIST insert,EDIT1,NumKey: 6
END
IF @NOT(@equal(%%num7,0))
LIST insert,EDIT2,"Num7 ==> "%%num7
LIST insert,EDIT1,NumKey: 7
END
IF @NOT(@equal(%%num8,0))
LIST insert,EDIT2,"Num8 ==> "%%num8
LIST insert,EDIT1,NumKey: 8
END
IF @NOT(@equal(%%num9,0))
LIST insert,EDIT2,"Num9 ==> "%%num9
LIST insert,EDIT1,NumKey: 9
END
%%ALT0 = @lib(user32,GetAsyncKeyState,int:,$30)
%%ALT1 = @lib(user32,GetAsyncKeyState,int:,$31)
%%ALT2 = @lib(user32,GetAsyncKeyState,int:,$32)
%%ALT3 = @lib(user32,GetAsyncKeyState,int:,$33)
%%ALT4 = @lib(user32,GetAsyncKeyState,int:,$34)
%%ALT5 = @lib(user32,GetAsyncKeyState,int:,$35)
%%ALT6 = @lib(user32,GetAsyncKeyState,int:,$36)
%%ALT7 = @lib(user32,GetAsyncKeyState,int:,$37)
%%ALT8 = @lib(user32,GetAsyncKeyState,int:,$38)
%%ALT9 = @lib(user32,GetAsyncKeyState,int:,$39)
IF @NOT(@equal(%%alt0,0))
LIST insert,EDIT1,Key: 0
END
IF @NOT(@equal(%%alt1,0))
LIST insert,EDIT1,Key: 1
END
IF @NOT(@equal(%%alt2,0))
LIST insert,EDIT1,Key: 2
END
IF @NOT(@equal(%%alt3,0))
LIST insert,EDIT1,Key: 3
END
IF @NOT(@equal(%%alt4,0))
LIST insert,EDIT1,Key: 4
END
IF @NOT(@equal(%%alt5,0))
LIST insert,EDIT1,Key: 5
END
IF @NOT(@equal(%%alt6,0))
LIST insert,EDIT1,Key: 6
END
IF @NOT(@equal(%%alt7,0))
LIST insert,EDIT1,Key: 7
END
IF @NOT(@equal(%%alt8,0))
LIST insert,EDIT1,Key: 8
END
IF @NOT(@equal(%%alt9,0))
LIST insert,EDIT1,Key: 9
END
GOTO evloop
:clearBUTTON
DIALOG clear,EDIT1
DIALOG clear,EDIT2
DIALOG focus,fake
goto evloop
:infoBUTTON
TITLE "Information"
INFO "I may ADD the rest of the keyboard keys someday."@CR()"Or you could whenever, plenty EXAMPLE here."@CR()"*Its easy to find these API online."@CR()"cheers.."@CR()@CR()"vtol@November 2024"
TITLE %%TITLE
DIALOG focus,fake
goto evloop
:fakeBUTTON
goto evloop
:CLOSE
FREELIB USER32
:close2
EXIT
|
cheers..
Description: |
|
Filesize: |
20.45 KB |
Viewed: |
21 Time(s) |
|
|
|
Back to top |
|
|
marcelo Contributor
Joined: 10 May 2008 Posts: 145
|
Posted: Fri Nov 22, 2024 11:38 am Post subject: |
|
|
Clap, clap, clap!!!
Excellent!!! Now I understand.
Thank you so much for the help!!!
Cheers.
|
|
Back to top |
|
|
vtol Valued Contributor
Joined: 05 Feb 2004 Posts: 648 Location: Eastern Indiana
|
Posted: Fri Nov 22, 2024 7:36 pm Post subject: |
|
|
I glad it helped
I wrote this kinda quickly and you can ignore /skip the readings of the bottom left EDIT2 box, I just wanted to see them results in case they were handy for something else and they seem to all be same result and not needed.
I didn't spend much time preventing DOUBLE key-press results, so you could prolly just get the KEY-press result in a special IF statement to prevent the MULTIBLE results - I'm sure you already knew all this
But now you can ADD any key you need for the future and of coarse your program may only need 1 or 2 keys, as you already know
Making a small 'get PIN number' dialog BOX, is what led me to trying to learn these API key(s).
cheers
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|