[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

27 Oct 2017, 10:21

Hello!

Just a quick reply here.... I worked all day to find and resolve bugs in the script. It had some major bugs yesterday. :-)

Current version is 3.21.

You can just redownload it.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

27 Oct 2017, 11:16

Hello!

An update with what I am up to in the future:

TO-DO:
Features to implement:
- show letters/chars generated by AltGr+[keys] - i hope to get this; done
- automatic list of dead keys, based on kbd layout - and this one done
- update - tray menu option done
- wrap mouse at screen edges
- disable caps when shift pressed done
- option for right to left resizing [right alignment] done
- external modifiers and key states monitor
- easy dragging to position OSD half way done; I implemented instead a feature at preferences to easily define OSD positions.

- text caret locator/highlighter
- window spy, get texts underneath the mouse using Narrator's accessibility APIs
- errors journaling?
- add comments through the source... present the code structure



Glitches to fix [by priority]:
- it capitalizes special chars that it should not [foreign layouts], eg., polish; done/fixed
- OSD is never on top of Start menu in Windows 10
- test different DPIs and the multiple monitor support.
- test on different computers and windows versions
- show a generic symbol for ignored dead keys; helps to clarify one was pressed; done
- quirky Shift + [numpad keys]
- sound beeps too loud; lower their volume?
- [minor bug] once a key is pressed, counting of key fires is not initiated after the OSD was hidden for a little awhile; done/fixed
- beeps do not fire for each key press if user types fast
- could all the defined characters for different kbd layouts in keypress-osd-languages.ini be replaced by DLL calls and APIs? now they are all hardcoded...
- automatic resizing of the OSD/GUI is just a silly hack based on the default font size and the number of typed chars; it often fails to resize properly; done/much improved
- redraw issues; it still flickers;
- make it work reliably with sticky keys; if user presses once Ctrl and another key afterwards, it rarely detects the combination on Winndows 7;


Best regards, Marius.
Last edited by robodesign on 16 Nov 2017, 05:16, 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.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

28 Oct 2017, 12:30

Helllooou, ppl!

New day, new version:

;; KeyPress OSD: CHANGELOG:

Download AHK file from:
http://marius.sucan.ro/media/files/blog ... ss-osd.ahk

by Marius Sucan (robodesign.ro)
v3.22 (2017-10-28)
- [new] option: shift turns off capslock
- [new] in "OSD appearances", an option to toggle between OSD positions
- [new] in "OSD appearances", buttons to facilitate defining OSD positions
- [new] tray menu option to toggle forced kbd layout once forced mode is enabled
- and minor bug fixes
- and significant improvements to Capture2Text feature; once activated, it (de)activates KeyPress features to ensure its proper functioning

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
JoeSchmoe
Posts: 129
Joined: 08 Dec 2014, 08:58

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

28 Oct 2017, 18:19

Amazing work, Marius. Is there a way to configure the script so that it keeps special keys visible after you press another key? (The way it keeps other characters visible after you press another key?)

I'd like to use this program to teach people how to optimally use their keyboard in technical computing. They will use their arrow keys heavily. What I find is that if I press an arrow key, everything I've typed so far disappears and I can't get it back. The same is true for Tab.

Is there any way to modify this so that it treats the arrow and tab keys the way that it treats the letter and number keys? I.e. so that it keeps everything up on the screen when you press them (and after)?
ozzii
Posts: 481
Joined: 30 Oct 2013, 06:04

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

29 Oct 2017, 04:02

Thanks for your work Marius.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

29 Oct 2017, 06:08

Hello!

@ Joe: Insert, Tab, Volume keys, Media keys and Wheel Up/Down should not erase the typed text. They key name appears, but if you continue typing, the text content "resumes". Please confirm this. If you want to add Left, Right and other keys, edit line 323 from the script. In the future, I intend to add support for a "virtual caret". That is, implement support for caret navigation: left / right, home/end, delete, ctrl+bksp, ctrl+left/right and even paste. I want to facilitate writing/typing as much as possible; I hope to succeed implementing this.

@ ezzii: thank you for writing; my pleasure

As always.... new day, new version:

Download AHK file from:
http://marius.sucan.ro/media/files/blog ... ss-osd.ahk

by Marius Sucan (robodesign.ro)
v3.23 (2017-10-29)
- [new] OSD automatically aligns to the right; if the defined position is too far to the right edge, it will expand to left

My purpose/intentions:
This is a script I am working to facilitate people with poor eyesight, in tasks such as writing (typing mode feature and... hopefully in the future, the virtual caret feature I mentioned earlier) or navigation (key presses and screen "reading").

My dream is to implement a "screen reader"-like feature that can be toggled when user wants. Any text that is underneath the mouse cursor should be captured and displayed on the OSD. I hope there is a way to use the Narrator APIs through DLL calls, to capture the texts on screen. I added the Capture2Text support to this very end, because it is good "for now". Capture2Text does Optical Character Recognition and it is not very efficient. It often fails to recognize characters and it is painfully slow to "read" a lot of text.

Visual demo:
Image
Image


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

29 Oct 2017, 07:53

Years ago there used to be at least one magnifier script, may still be at the old archived boards or in JoeDF's archive. With a few modifications it could be of help in achieving your goal of reading text under cursor.
Windows used to have its own magnifier utility too, but it may not be installed on all systems since it belongs to the Accesibility set of features.
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

29 Oct 2017, 09:11

@ Reloaded: thank you

Drugwash: I am not making a magnifier :-) . Yes, windows has a screen magnifier and I am using it daily.

Please read carefully what I said earlier. I want to capture text, not as image, but as true text. Windows Narrator does it, JAWS as well. Others can do it too :).

For now, I am focused on the typing mode, to make improvements to it. That is, AltGr support, better dead keys support, etc.

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

29 Oct 2017, 10:09

I'm probably not understanding the full extent of your goal, but that's alright. Anyway, grabbing text from native Windows controls should be relatively easy, but other window classes may prove to be a challenge. ;)
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

29 Oct 2017, 14:58

Hello, people ;-)

It is not a new day for me... but a new version is available:

v3.24 (2017-10-29)
- [new] Update option. Once you click on it, it automatically downloads external files and itself. You can now always have the latest version :) ... while your settings remain intact

Download AHK file from:
http://marius.sucan.ro/media/files/blog ... ss-osd.ahk

From this version on, you just have to click Update now and, you'll get the latest files. No need to bother downloading it manually, over and over. Whenever I announce a new version here, you can just use the Update option in the tray menu.

I hope this will facilitate, along with the Preferences windows, the usage of this script.

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.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

30 Oct 2017, 06:53

Hello, guys!

New version is here... Minor changes:

v3.25 (2017-10-30)
- [new] option to disable right alignment; useful for those that want to place the OSD on a secondary screen
- [new] option to make navigation keys never erase typed text from the OSD

If you have v3.24, use the "Update now" option from the tray menu :-).
.... otherwise, download AHK file from:
http://marius.sucan.ro/media/files/blog ... ss-osd.ahk

The following updates will takes some time as I want to think of a good solution in regards to the improvements I want to make for the typing mode.

Best regards, Marius.
Last edited by robodesign on 01 Nov 2017, 03:38, 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.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

30 Oct 2017, 13:31

v3.26 (2017-10-30)
- [improved] OSD resizing is much more precise thanks to GetTextExtentPoint [from Sean, https://autohotkey.com/board/topic/1641 ... ntry107363 ]

just me, again :)
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

31 Oct 2017, 14:46

Hello!

New version:

v3.27 (2017-10-31)
- dead keys support per layout; I defined the dead keys for several languages. I have to go through all the 50 layouts I added support for, to define the dead keys for each... I might not do it soon...
- [new] option to ignore specific key [that is, in addition to the dead keys]
- removed the deadkeys option from preferences; it is always on for the layouts that have such 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.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

01 Nov 2017, 15:44

Hello, followers!

Still ironing out the kinks out of it and... making improvements:

v3.28 (2017-11-01)
- various fixes; modifiers and counting; previous key glitches; improved switching between forced kbd layouts and so on...
- [improved] number of letters calculated dynamically based on OSD size
- [new] option to set maximum width for dynamic OSD size
- as a consequence, removed the values for max. typed letters from settings
- added the ability to define caps exclusion list per keyboard layout; when I will go through the whole list of layouts I have to consider this too; it will no longer capitalize letters it should not to, after I go through all the kbd layouts to define them....


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.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

03 Nov 2017, 11:35

Hello!

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

by Marius Sucan (robodesign.ro)
v3.29 (2017-11-03)
- many fixes; the major thing I did is to rework the code for counting of key presses and key fires

Not much to write about this new release, but a lot of work has gone into it and many bugs were fixed. I think it is beyond my usual alpha-like releases. For the past few versions I worked only on solving bugs.

Next is AltGr support and then, hopefully virtual caret navigation.

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.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

05 Nov 2017, 13:39

Hello!

Recent change log:
v3.32 (2017-11-05)
- improved support for dead keys... now they are defined per modifier: Shift, AltGr or no modifier.
v3.31 (2017-11-05)
- better detection for keys to bind, for different layouts; it does not rely anymore on hard-coded lists of keys for each layout
v3.30 (2017-11-04)
- AltGr support implemented

The version is not yet public. I need to fix some bugs and to better define kbd layouts. That is, make lists of dead keys and AltGr 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.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

07 Nov 2017, 13:01

Hello!

The public release has been updated to v. 3.29.1. I discovered some silly bugs :) ... Constant autodetection of KBD layouts was borked for quite many releases due to a typo...

Today I extended AltGr support to include support for Shift as well. I began working on language definitions; 10 out of 50 finished.

When I finish defining the German, French and Spanish variety of keyboard layouts, I will make a release - hopefully in a few days.

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

07 Nov 2017, 13:37

Take your time, do a fine job! ;)
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

10 Nov 2017, 16:24

Hello!

New version here..... See change logs here for details. 35 keyboard layouts left to implement/define. If you have an ini file from this script, please delete it.

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

Make sure the script is able to download the language definitions file. If it does not, tell me :-). Remove old file, if present.

Change log:
v3.37 (2017-11-10)
- full support for 30 keyboard layouts; AltGr, Shift and dead Keys
- [new] tray menu indicates current kbd layout
- bug fixes and improvements related to AltGr and dead keys, constant kbd detector
v3.35 (2017-11-07)
- extended AltGr support and I began working on language definitions; 10 out of 50 finished....
v3.34 (2017-11-06)
- [new] display a generic dead key symbol when pressed, in typing mode;
- [new] option to turn off dead keys being displayed in the OSD
- [new] option to enable/disable automatic removal of dead keys from the OSD on backspace
- [new] option to enable/disable AltGr support. It can be disruptive :-).
- shows a caret as you type; by default, Spacebar is now displayed as space

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.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 120 guests