[Script] KeypressOSD - Display key press on screen

Post your working scripts, libraries and tools
User avatar
Drugwash
Posts: 307
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: [Script] KeypressOSD - Display key press on screen

11 Nov 2017, 08:39

Hi, tested 3.37 earlier today. Mouse halo and flash don't seem right. And for some reason typing an exclamation mark is sometimes displayed as '1' (as opposed to '!') while Capitalized letters are sometimes displayed lowercase, as if the state of Shift weren't always taken into consideration. Not much testing beyond that.

Damn board doesn't allow attaching AVI files (253kB) - I had installed a shareware application specifically for capturing the mouse issue. Then trying to attach it as an 110kB archive popped a 'reached quota' message. Why does everything have to be so anal??? :thumbdown: :thumbdown: :thumbdown:
robodesign
Posts: 130
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
Contact:

Re: [Script] KeypressOSD - Display key press on screen

13 Nov 2017, 14:13

Hello, followers!

I am happy to announce virtual caret navigation is here and fully working.

Image


Image

v3.42 (2017-11-13)
- [new] the OSD holds in memory more text than it displays, such that you can navigate through it
- [new] option in the tray menu to toggle constant keyboard layout monitoring
- bug fixes and improvements
v3.40 (2017-11-12)
- [new] virtual caret navigation: support for left, right, delete and backspace; navigate synchronously through text, as in the host app

Next major improvements are to implement Ctrl+Backspace/Delete/Left/Right, Paste and then more bug fixing.

Download AHK file from or use the Update now option:
http://marius.sucan.ro/media/files/blog ... ss-osd.ahk

Best regards, Marius
robodesign
Posts: 130
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
Contact:

Re: [Script] KeypressOSD - Display key press on screen

13 Nov 2017, 14:19

Hello, drugwash !

Thank you for testing the script! I am surprised you are experiencing these issues. Do you use Windows 10? Afaik, you have WinXP.... I did not have any chance to test my script on any other version of Windows, but 10. Are you certain Shift+1 does not render to *!* ? I never had such issues with it What you are describing is that AHK does not always detect Shift being pressed...

Please test the new version ;-). I made major improvements to it.

Best regards, Marius
User avatar
Drugwash
Posts: 307
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: [Script] KeypressOSD - Display key press on screen

14 Nov 2017, 09:50

Marius, you can always put up a virtual machine to test various OS versions. I've had my share of surprises where same script under same AHK version would perform differently or not at all on different OS versions. That's M$ for you, what can I say.
I can't (and even if I could I wouldn't) use the abomination called Win10. No need to get into reasons or whatnot.

I can't attach the video with mouse issue here so please see the following:
- halo
- halo with idle flash

Shift is somehow processed in an awkward way, I don't think the OSD should display Shift+S (for example) when typing a capital S, yet sometimes - but only sometimes - it does. And yet sometimes typing a capital letter will be displayed as lowercase, which is the same issue as exclamation mark being displayed as 1. This is inconsistent behavior. May be related to slow CPU and/or anything else.

You once told me to modify a certain line to restore a normal behavior. Right now it's doing that again: dissapearing very fast while typing and display being cut off in certain situations. Could that be made a permanent option saved/loaded in the ini? It's about the +E0x20 style which I see being used in mouse GUIs as well.

How would one create an exception for certain hotkeys, such as Ctrl+PrtScn, Ctrl+Alt+PrtScn or similar? I tried to get a screenshot through one of those shortcuts and the OSD changed defeating the purpose.

Tests were performed using v3.42, screenshots may show an older version but mouse halo/flash behavior is unchanged.
robodesign
Posts: 130
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
Contact:

Re: [Script] KeypressOSD - Display key press on screen

14 Nov 2017, 13:27

Hello !

Thank you for your comprehensive reply.

The mouse halo is indeed not centered beneath the mouse, but it looks as expected, as a square :-).

You cannot add exceptions for key combinations.

I could however add an option for alternative OSD rendering, which would toggle +E0x20 style Have you tried the option to enable a border around the OSD?.... doesn't it help? Please let me know. I can add the option for the +E0x20 style.

Best regards, Marius.
User avatar
Drugwash
Posts: 307
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: [Script] KeypressOSD - Display key press on screen

14 Nov 2017, 13:52

Thank you for acknowledging the issues (present in XP).
I hadn't tried the border option so far; enabled it now and it still exhibits the same behavior, just that it doesn't always dissapear quickly. But it sometimes does. And also the border gets removed sometimes. I feel it's the fault of a timer.

The E0x20 style fix could be added under a generic 'display fix for XP' option or something similar; it would be great if you or anybody else could test other OS versions and report whether the issue appears or not so that a range of OS could be tested at startup and settings would be adjusted accordingly, preferrably without user intervention.
robodesign
Posts: 130
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
Contact:

Re: [Script] KeypressOSD - Display key press on screen

14 Nov 2017, 14:44

Drugwash, please update the version. It is now 3.43 and it should have a fix for E0x20 style on WinXP.
I added this:
if (A_OSVersion!="WIN_XP")
Gui, OSD: +E0x20
so, on XP, it should not be set anymore.

I also fixed some Shift related problems, probably it works now better for you as well.

Best regards, Marius
User avatar
Drugwash
Posts: 307
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: [Script] KeypressOSD - Display key press on screen

15 Nov 2017, 13:04

Still something fishy with Shift: when pressing and keeping pressed it counts two presses. Keyboard is fine, no false contacts.
When typing for the first time or after an <Enter>, it still displays Shift + 1 instead of exclamation mark.
Image

The extended style fix is working fine, thank you.
robodesign
Posts: 130
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
Contact:

Re: [Script] KeypressOSD - Display key press on screen

15 Nov 2017, 15:13

That is correct behaviour. it shows the keyboard shortcut/combo. When you type, it must show exclamation mark, only .

Best regards, Marius
robodesign
Posts: 130
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
Contact:

Re: [Script] KeypressOSD - Display key press on screen

16 Nov 2017, 10:36

Hello, people!

I have a new version for you ;-)

Change log:
v3.45 (2017-11-16)
- [new] distinct beep for recognized dead keys; option to enable/disable this in Settings
- [new] typed text history with page up and down. It records typed text on (Shift+) Enter key. After user copies text to clipboard, s/he can switch with Page down to that text. Option in Settings to enable/disable this feature.
- bug fixes and improvements related to AltGr, Shift and Numpad keys, and missing language definitions file.

Download AHK file from or use the Update now option:
http://marius.sucan.ro/media/files/blog ... ss-osd.ahk

I am having difficulties implementing further support for caret navigation . Now the support is limited to backspace, delete, left and right, home and end. I would like to support actions with Ctrl as well. Unfortunately, there is inconsistency across applications on how the text cursor/caret jumps between words and symbols.

Best regards, Marius.
User avatar
Drugwash
Posts: 307
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: [Script] KeypressOSD - Display key press on screen

16 Nov 2017, 12:39

robodesign wrote:That is correct behaviour. it shows the keyboard shortcut/combo. When you type, it must show exclamation mark, only .

If I'm not mistaken, Shift + any character would yield either a capital character or some symbol. Why would the combo be displayed in such case? Starting a sentence is usually done with a capital letter which should be displayed accordingly and in some languages (such as Spanish, for example) sentences may begin with a symbol such as ¿ or ¡ (which may or may not make use of the Shift key). Somebody please correct me if I'm wrong.
Haven't tested 3.45 yet, too tired. Will see how it goes.
robodesign
Posts: 130
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
Contact:

Re: [Script] KeypressOSD - Display key press on screen

16 Nov 2017, 13:23

You did not test my script enough :-)

If you press Shift + [any number/key].... more than once, you will begin typing mode and it will show the symbols or capitalized letters. I was careful about this... :-)
User avatar
Drugwash
Posts: 307
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: [Script] KeypressOSD - Display key press on screen

17 Nov 2017, 04:47

Maybe I'm thick but I don't get the logic behind this Shift… shifting behavior.
I see there's an option to disable typing mode but there's no option to always be in typing mode - maybe that would fix my troubles with Shift.
I't simple: when I start a new row/sentence I want to see a capital letter (or the desired symbol), not Shift + whatever. Can you please do that?
robodesign
Posts: 130
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
Contact:

Re: [Script] KeypressOSD - Display key press on screen

17 Nov 2017, 13:36

I am thinking of adding an option to always be in typing mode and then, never show key combinations.

However, please try this...
1. Type a sentence
2. Hit enter.
3. Begin by Shift+[whatever letter/number/symbol]
4. and continue to type

If you pressed, for example Shift+E, the word you will see on screen will begin with a capitalized E.

I am working now on reducing flickers and on solving cursor related problems. I also fixed some bugs today. I hope to release something on Sunday.

Best regards, Marius.
User avatar
Drugwash
Posts: 307
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: [Script] KeypressOSD - Display key press on screen

17 Nov 2017, 13:54

Done that in the past and it did not display capital letters, that's precisely why I mentioned the issue. The exclamation mark was just a quick example.
Anyway, don't bother - if this community is going to turn into a prison I'll be soon outta here.
robodesign
Posts: 130
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
Contact:

Re: [Script] KeypressOSD - Display key press on screen

17 Nov 2017, 16:30

Then maybe, I have a bug.... erm.... I have to investigate this further. Thanks, man ;-)

I constantly use the script and this particular feature and it works for me.... I need to ask other people to test it for me.
burque505
Posts: 137
Joined: 22 Jan 2017, 19:37

Re: [Script] KeypressOSD - Display key press on screen

17 Nov 2017, 17:05

Hi Marius, I've just tested your script for the first time. I know Cyrillic support is not intended to be offered, but I thought maybe you'd like to know what happens when somebody tries it :)
For me, Win7 64-bit, AHK_H U64, the Cyrillic letters display just fine, but a notification flashes back and forth between "Layout changed to: 0x4190419" and "Layout detected: ENGLISHUS (kbd0409)". I just tried it with German and Spanish too, analogous results. I'll try it on Win10 when I get chance. Thanks for your work on this.

P.S. Just discovered the tray menu option to turn off monitoring keyboard layout. That way it works for Russian, Ukrainian, German and Spanish, at least. It would be very nice to turn off the Shift + behavior, I agree with Drugwash on that.

Great stuff.

Regards,
burque505
robodesign
Posts: 130
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
Contact:

Re: [Script] KeypressOSD - Display key press on screen

18 Nov 2017, 04:49

Thank you very much for the message Burque. I had Windows 7 x64 until .... fairly recently, but I upgraded to Windows 10. I am glad to hear that turning off the keyboard monitor makes it work for you.

The limited Cyrillic support is a byproduct of a recent improvement I made to the script's keyboard detection system. For Spanish, German, English and so on, there's complete support, which include Shift, AltGr and dead keys. For Russian or other undefined layouts, it can only detect the keys to bind to, and in many cases, not all of them.

Please try explaining to me the Shift behavior problem, from your perspective. I want to fix this.

Best regards, Marius.
robodesign
Posts: 130
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
Contact:

Re: [Script] KeypressOSD - Display key press on screen

18 Nov 2017, 13:34

Hello, ppl!

New version, many improvements under the hood, to make it more responsive. I am happy I managed to reduce, considerably, the flickers of the OSD and the much improved support for caret navigation and long texts.

Download AHK file from or use the Update now option:
http://marius.sucan.ro/media/files/blog ... ss-osd.ahk

CHANGE LOG
v3.48 (2017-11-18)
- [much improved] cursor navigation related issues; now it will always display the caret and never run outside the visibility area; it also no longer jumps on screen - it moves as expected
- [new] option to never display the OSD, such that those who want it only to beep or show mouse clicks can use it without the OSD
- [new] option to prioritize key press beeps; if activated it will attempt not to skip generating beeps, however this will interfere with the accuracy of the OSD when typing

v3.47 (2017-11-17)
- various bug fixes and improvements
- [fixed bug] AltGr does not cause anymore unnecessary text cursor movement in the OSD
- [fixed bug] changing OSD colours works again :-)
- considerably reduced flickering of text in the OSD

I hope you guys will like better this new version.

Drugwash, please test this version. I changed the display to use a GUI edit field, it was using a GUI text. I hope it still works on XP.

Best regards, Marius
burque505
Posts: 137
Joined: 22 Jan 2017, 19:37

Re: [Script] KeypressOSD - Display key press on screen

18 Nov 2017, 19:24

Marius, thank you, that's really a big improvement, at least for me. I think it has also removed my issue (or non-issue, maybe) with the Shift behavior.
Maybe that was addressed before, but regardless it's no problem for me after your latest update.
Still working good on Win7 64-bit, AHK_H U64, Cyrillic too. If I get a chance to try XP in a VM I'll do that and post my results.

Thanks again, great stuff!
Regards, burque505

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 15 guests