[Script] KeypressOSD - Display key press on screen

Post your working scripts, libraries and tools for AHK v1.1 and older
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

30 Nov 2017, 15:18

Hello!

New version:

v3.63 (2017-11-30)
- [new] it generates a list of installed keyboard layouts, in the tray menu; on click, KeyPress switches to the selected layout [forced mode].
-------
- much improved behavior for shift + numpad keys
- changed code regarding num/scroll/caps lock keys
- fixes/improvements for layout detection

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

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

01 Dec 2017, 01:42

Something went wrong. Earlier I downloaded this version and accidentally started it from the download location instead of copying and running from the test location. Since no ini, no language file and no sound files were present, it started downloading them automatically. It beeped and displayed "downloading language file […]" about four times and got stuck at that, never got back to proper operation, so after a few minutes I exit the script.
However, looking in its folder the ini, the language file and the sound files were all there, it had successfully downloaded them. So it did its job but failed to display it in the OSD and return to normal operation.

If I may offer another suggestion: please move all sound files in a subfolder for a more compact structure. ;)
Part of my AHK work can be found here.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

01 Dec 2017, 05:23

hmm... Did it work on restart?

I tried that, just the ahk file, on both of my systems.... it all seems fine.

Thank you for reportıng thıs to me.

Best regards.... Marıus.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

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

01 Dec 2017, 08:43

Yes, it works fine after restart.
One possible explanation is a network hiccup right in the middle of updating. Didn't try to reproduce it, got other work to do (and vodka to drink, since it's our national holiday). :)
Don't sweat it, have a drink. La mulţi ani! :)
Part of my AHK work can be found here.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

01 Dec 2017, 09:26

Merci, man; hehe; La mulți ani și ție! (happy birthday)

Until now, at this hour (16h)... I tried to fix a bug. I was not able to fix it. Fail. .... The bug is: in Metro/Windows Store apps, it does not detect keyboard layout changes.

And I still got 37 layouts to go through and identify by SC/VK each dead key.

Best regards, Marius.
Last edited by robodesign on 01 Dec 2017, 17:25, edited 3 times in total.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

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

01 Dec 2017, 09:43

Thanks. :)

See if this is of any help: link
Part of my AHK work can be found here.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

01 Dec 2017, 17:32

Thank you very much. I've seen that already. I can get the language code, but not the exact keyboard layout. I don't know exactly why.

I've experimented with different types of detecting the keyboard layout, but none detects any change while a metro app is the active window.

I thought of detecting the keyboard layout for a specific application. Is this possible? In windows 10, keyboard layouts are not per app (only if one activates that).... This is why I would try this.

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

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

02 Dec 2017, 12:19

Sorry, dunno how Win10 works and I'm way behind with the new API.
However I've opened another can of worms: I've built and installed a custom layout using KLM Lite and your script does detect a change of layouts but fails to properly detect the modded one so it falls back to default. No biggie, I've already deleted that layout because the lite version doesn't allow processing of AltGr and other keys.
Part of my AHK work can be found here.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

02 Dec 2017, 12:38

Hello!

Today's new version:

v3.64 (2017-12-02)
- many important bug fixes related to typing;


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

@Drugwash: yes, custom layouts are unsupported. I have a custom kbd layout too, for which KeyPress has support for it :-). Try Microsoft Keyboard Layout Creator. I made mine with this one.

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

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

02 Dec 2017, 15:40

Nah, MSKLC is weak and I don't like that it phones home. I'm over custom layouts anyway, it was just a whim.

I'll test the new script version tomorrow, now Lily is sleeping in my lap and I'm typing in OSK with he mouse. :)
Part of my AHK work can be found here.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

03 Dec 2017, 11:55

Hello, followers!

New version:

v3.65 (2017-12-03)
- [new] optıon to change the color for caps lock hıghlıght
- agaın... important bug fixes related to typing

Some notes on the recent activities... Since burque505 signaled me the bug with dead keys I discovered additional bugs and I fixed various typing related bugs and I went through all the 80 keyboard layouts I implemented support for. From these, only 6 left. Hopefully I will fix these last six layouts tomorrow. Now all dead keys are identified by Scan Code and Virtual Key such that they are detected appropriately on any system. Special/foreign keys are identified now by another function which gets the key name properly. GetKeyName() is not good :-).

I also have now Windows 7 x64 in VirtualBox and I discovered additional bugs, regarding OSD redraw issues. It was flickering insanely. I fixed this. I will try to fix the mouse related issues (misplaced halo and others) as well...

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

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

03 Dec 2017, 13:58

Yesterday I read Michael Kaplan's entire series on Getting all you can out of a keyboard layout. It's insane.

I hope this script will stop sniffing on the clipboard soon.
In the mean time it still misses some Shift presses in the middle of a sentence (typing mode is always active) and sometimes other characters too, such as Space. Maybe I'm typing too fast for this machine?
Part of my AHK work can be found here.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

03 Dec 2017, 16:54

Stop saying that it's sniffing the clipboard :-), you make it sound bad....

On my pc, it doesn't skip keys. Please try running it on high priority and let me know if it still skips keys.

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

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

04 Dec 2017, 04:54

In my humble opinion this kind of script should be developed - or at least tested - on a modest machine, to make sure it fits in terms of speed and accuracy. It may work just fine on a 16-core CPU and 64GB of RAM running the latest OS version, but not everybody owns such machine and here you go surprises from someone like me. ;)

Changing AHK's priority everytime the script is launched does not sound like a feasible solution. :?
skippedShift.png
skippedShift.png (49.67 KiB) Viewed 2422 times
Part of my AHK work can be found here.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

04 Dec 2017, 13:20

Hello!

The new version should no longer skip binding keys and should always detect proper key name/char. Here's the new version:

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

Change log for v3.66 (2017-12-04)
- improved detection of the available keys to bind; it no longer depends on lists
- finished defining dead keys as SC/VKs for all the supported keyboard layouts, in total... 79
- removed option to bind additional keys, from Keyboard preferences.

@ drugwash: I have a modest PC :-) and it works just fine. I could add a line to make it run on high priority. Should I? does it help?

Coming next: support for about 10-15 keyboard layouts with Greek and Cyrillic alphabet. After, I will try to add more caret navigation features. Meanwhile, I will tend to bugs...

@ burque505. Please test the Spanish layout.

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

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

04 Dec 2017, 14:29

Define modest. ;) Mine is a HP Vectra VL420 with a 1.8GHz Pentium4 CPU (single core) and 1GB SDRAM (PC133). Can you beat that in terms of modesty? :)
And that's the XP machine; if I were to test the script in my 98SE machine - assuming it would work with AHK 1.0 - then you'd have to beat 667MHz Pentium III CPU and 512MB PC133 SDRAM. That is my development machine and usually everything that works on it would also work- AHK 1.1 quirks apart - on the XP one and probably other people's much better machines. :)

Back to the script: I haven't yet tested with changing priority, been working on that darn XML parser that I can't get useful help with. But looking at the running processes I only see winlogon and the bluetooth service running with high priority, all others run at normal so I'd rather not push my luck. ;)
Part of my AHK work can be found here.
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

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

04 Dec 2017, 16:02

HI Marius, here's my Spanish "smoke test."
Working: !"·$%&/()=?¿@, _-:.,ñÑçÇ
Not working: éóúíá,èìòùà, ëïüöä, êîôûâ (caps don't either). What appears is a Unicode 'white square', which should appear for me here with Alt+25A1 but doesn't, before each letter.
Regards,
Winter
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

05 Dec 2017, 03:58

Hello, burque505 / Winter

Thank you very much for testing my script.

You mean... dead key combinations like... 'e = é ? These chars... éóúíá, èìòùà, ëïüöä, êîôûâ... look like those you get with dead keys of different accents.

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

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

05 Dec 2017, 11:37

Hi Marius, yes, you're right. Those are all dead key combinations.
Regards,
burque505
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

05 Dec 2017, 14:09

Hello!

New version is here:

v3.67 (2017-12-05)
- bug fixes related to dead keys support
- added complete support (Shift, AltGr and dead keys) for Vietnamese, Albanian and Wolof keyboard layouts
- now it recognizes additionally 24 keyboard layouts;

The total of recognized keyboard layouts is 224 .... out of which 105 layouts are supported.

@ burque505:

Dead keys support means:
- recognize it's a dead key and don't kill it's functionality for users using such keys
- show a symbol in the OSD when one presses such a key

The behaviour of dead keys in the OSD can be modified at Typing mode settings. One can choose different ways to treat dead keys... I have no idea how to get the Dead key combinations, maybe some DLL calls could do this...

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


Best regards, Marius.
Last edited by robodesign on 07 Dec 2017, 13:39, edited 1 time in total.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: tidbit and 116 guests