[Script] KeypressOSD - Display key press on screen

Post your working scripts, libraries and tools
robodesign
Posts: 376
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
GitHub: mariussucan
Location: Romania
Contact:

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

Post by robodesign » 01 Feb 2018, 10:34

hehe, great to hear! thanks!
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
My home page.
robodesign
Posts: 376
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
GitHub: mariussucan
Location: Romania
Contact:

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

Post by robodesign » 02 Feb 2018, 13:11

Hello, guys!

Finally, a new version is here:

it is best to use the Update now option from the script. Additional files were added.

On GitHub: https://github.com/marius-sucan/KeyPress-OSD

Main AHK file:
http://marius.sucan.ro/media/files/blog ... ss-osd.ahk
Please use AHK_H v1.1.27 [unicode] to execute this script.

ZIP Package compiled [x64 / x32]
http://marius.sucan.ro/media/files/blog ... mpiled.zip

Change log

v4.18.1 (2018-02-02)
- [new] mouse text collector [experimental new feature]; with this feature enabled, KeyPress will continously capture text underneath the mouse cursor from applications that implement the Microsoft's Accessibility APIs [MSAA] and allow screen readers. The implementation of this feature makes use of scripts written by nepter(?), Sean and jethrow...

- [new] option to enable/disable "LEDs" to indicate key states in the OSD. This applies for Alt, Ctrl, Shift, Winkey and Caps / Num / Scroll lock. [inspired by some of the work from Drugwash]

- [improvement] if the cursor is at the end or beginning of the line, the caret changes into different shapes, corresponding to the following keys: left/right, home/end, up/down, page up/down, bksp/del... this is meant to offer visual feedback to the user when the caret remains still and these keys are pressed [inspired by some of the work from Drugwash]

- [improvement] if Large UI fonts is enabled and the preferences window is larger than the available screen resolution, user is given the option to deactivate Large UI fonts.

Please take note, the new feature to capture text is buggy as... it can be :-).

Best regards, Marius.
Last edited by robodesign on 03 Feb 2018, 07:46, edited 1 time in total.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
My home page.
User avatar
Drugwash
Posts: 567
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania

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

Post by Drugwash » 03 Feb 2018, 06:37

Oops, error: Target label does not exist.
Line 3502: SetTimer, GetAccInfo, 120, 50, UseErrorLevel

This is because older versions of the script did not have a need for keypress-acc-viewer-functions.ahk or UIA_Interface.ahk and therefore those files do not yet exist in the keypress-files folder and there is no way for an old script to retrieve those files from your server.

Warning: the following applies only to those who manually downloaded the current version of the uncompiled script and replaced the old one without having a backup.

One way of dealing with this is to use #include *i <filename> inside the ToggleCaptureText() function, while having the current contents of the function moved into that <filename> file. This way, if that file is not found to be included, the GetAccInfo label would not be found missing by the script and resulting in the error mentioned above, but instead the usual script error would be displayed allowing the script to run normally. A manual update operation would be necessary after that.

So here's the necessary modifications for the current version of the file (4.18.1) if you accidentally upgraded only the main file manually:
1. Function in the main script:

Code: Select all

ToggleCaptureText() {
    #include *i keypress-files\text-capture.ahk
    ShowLongMsg("ERROR: Missing files...")
    SoundBeep, 300, 900
    Sleep, 600
    HideGUI()
}
2. New file bearing old function's contents plus a necessary Return, named text-capture.ahk* as appears in new function contents:

Code: Select all

    If !FileExist("keypress-files\keypress-acc-viewer-functions.ahk") || !FileExist("keypress-files\UIA_Interface.ahk")
    {
      ShowLongMsg("ERROR: Missing files...")
      SoundBeep, 300, 900
      Sleep, 600
      HideGUI()
      Return
    }
    TextZoomer := !TextZoomer
    Menu, tray, % (TextZoomer=0 ? "Uncheck" : "Check"), Mouse text collector
    If (TextZoomer=1)
       SetTimer, GetAccInfo, 120, 50, UseErrorLevel
    else
       SetTimer, GetAccInfo, off
    Sleep, 400
    Return
3. Additions to main script, line 5317:

Code: Select all

    captureFile := "keypress-files\text-capture.ahk"
    accFile := "keypress-files\keypress-acc-viewer-functions.ahk"
    accUIFile := "keypress-files\UIA_Interface.ahk"
and a few lines further (new line 5337), the FilePack string modified as follows:
FilePack := "beepersFile,ripplesFile,mouseFile,historyFile,captureFile,accFile,accUIFile,faqHtml,presentationHtml,shortcutsHtml,featuresHtml"
and then another little bit further just before the Loop, Parse, FilePack, CSV:

Code: Select all

    If !FileExist(captureFile)
	    FileMove, keypress-files\text-capture.txt, %captureFile%
* The text-capture file should not bear the ahk extension locally when this version of the script is first launched; it should be named as text-capture.txt and placed in the keypress-osd folder, it will automatically be renamed by the main script after the other two files were unpacked and placed in their corresponding folder.

I believe that would be all to make the script run and update correctly to this version and higher. Of course, the two additional files would have to be present în the zip file on the server, otherwise everything would be in vain (and indeed they are there).
I've deleted my CloudMe account because of GDPR - the now legal base for privacy invasion and data theft.
robodesign
Posts: 376
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
GitHub: mariussucan
Location: Romania
Contact:

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

Post by robodesign » 03 Feb 2018, 07:43

The errors you get apply only for manual update. And incorrect update.

Use the update option from the script, the built-in function and everything is going to be fine.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
My home page.
robodesign
Posts: 376
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
GitHub: mariussucan
Location: Romania
Contact:

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

Post by robodesign » 03 Feb 2018, 14:52

Hello, guys!

v4.18.2 (2018-02-03)
- fixed bugs related to missing files; it now works even if ALL external files are missing
- re-added option to mediate Left/Right and Delete keys for slow computers
- improved behavior when the language definitions file is missing; it no longer disables stuff it shouldn't

Today's version and later versions, will allow you to execute the bare minimum of this script, that is ... only the main code.

Main AHK file:
http://marius.sucan.ro/media/files/blog ... ss-osd.ahk
Please use AHK_H v1.1.27 [unicode] to execute this script.



Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
My home page.
robodesign
Posts: 376
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
GitHub: mariussucan
Location: Romania
Contact:

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

Post by robodesign » 04 Feb 2018, 08:39

Holla, people!

@ozzii: Version dedicated to you :-). Because it works in AHK_L as well, if you delete one line.

CHANGE LOG:

v4.18.3 (2018-02-04)
- [improvement] the main file can be executed with AHK_L, if the line with "ahkThread_Free(deleteME)" is commented or deleted; [this line is at the end of the file :-) ]
- [fixed] a minor bug with caret navigation
- [new] added global keyboard shortcut for Silent mode
- the shortcut for Capture2Text was changed to Capture text [with MSAA, Acc Viewer]... By default, disabled.


On GitHub: https://github.com/marius-sucan/KeyPress-OSD

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

ZIP Package compiled [x64 / x32]
http://marius.sucan.ro/media/files/blog ... mpiled.zip

All binaries, packages and GitHub updated.

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
My home page.
SpencerH
Posts: 15
Joined: 18 Jan 2018, 16:04
Facebook: http://fb.com/mrhobbeys

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

Post by SpencerH » 04 Feb 2018, 23:03

Is there some way to make my script show what it is doing like this? I think this could be really helpful
ozzii
Posts: 309
Joined: 30 Oct 2013, 06:04

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

Post by ozzii » 05 Feb 2018, 03:01

@robodesign
Thanks for the version.

Questions:
-I've deleted the not needed lines.
-The script download the needed files
-I update the script (but I have last version) from the menu....
-The script download some files, and restart...
-Error for the line to delete ;(

So, the script updated even when not needed


I don't know if it's not too complicated to have a sort of 2 files for downloading depending of the AHK version (L or H).

What do you think ?
robodesign
Posts: 376
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
GitHub: mariussucan
Location: Romania
Contact:

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

Post by robodesign » 05 Feb 2018, 04:27

@spencer I do not understand your question.

ozzii: You just have to delete the line I specified, the one with DELETEME, no other line.

Please tell me, does it work? Delete ONLY the line I told you, then start it. It will download the language definitions file... Then it should wok.

If you get error messages, tell me.

Please redownload the script. I made it no longer download unnecessary files when running with AHK_L.

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
My home page.
robodesign
Posts: 376
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
GitHub: mariussucan
Location: Romania
Contact:

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

Post by robodesign » 05 Feb 2018, 09:07

KeyPress OSD video presentation:

Last edited by robodesign on 05 Feb 2018, 14:23, edited 1 time in total.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
My home page.
burque505
Posts: 580
Joined: 22 Jan 2017, 19:37

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

Post by burque505 » 05 Feb 2018, 11:50

:bravo: Slick, Marius! Nice job.
Regards,
burque505
robodesign
Posts: 376
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
GitHub: mariussucan
Location: Romania
Contact:

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

Post by robodesign » 05 Feb 2018, 16:35

Hello, guys!

Today's new work features some great work from drugwash...

On GitHub: https://github.com/marius-sucan/KeyPress-OSD

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

Binaries not yet updated. More testing required.


v4.19 (2018-02-05)
- [improvement] language file no longer needed; it is automatically generated when KeyPress is executed; it discovers automatically the dead keys of the current layout; MANY thanks to Drugwash for his magic coding!!!!

@burque505: Please test this version. Please let me know if it identifies all the dead keys correctly on your system.

Best regards, Marius....
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
My home page.
burque505
Posts: 580
Joined: 22 Jan 2017, 19:37

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

Post by burque505 » 05 Feb 2018, 18:30

Hi Marius, the latest version works fine. All dead keys working here.
Regards,
burque505
ozzii
Posts: 309
Joined: 30 Oct 2013, 06:04

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

Post by ozzii » 06 Feb 2018, 04:17

@robodesign
What I wanted to say it's that the update is done even when I have the latest version of the script.

Any chance that you check the version of the script before doing the update? So that the update is done only when a new version is available...

Can you add in the OSD placement the corners? I have 2 monitors, and the actual settings are not practical.
I would like to have something like, for example, down left corner minus 5px. What do you think about that?

P.S.: Thanks for all your work. Very helpful. Also working with the 2 Serbian's keyboard layouts.
robodesign
Posts: 376
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
GitHub: mariussucan
Location: Romania
Contact:

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

Post by robodesign » 06 Feb 2018, 07:15

Hello, ozzii!

Okay, listened to your request. Others have requested this in the past, as well.

The new version has this new feature implemented. It will inform you if a new version is available or not when you click on "Check for updates".

As a consequence of yesterday's changes, the script now initializes considerably faster. [thanks again Drugwash!]

The option to automatically place the OSD at corners [or margins] is a bit... tricky for me to implement, especially in the context of multiple monitors / screens. So, for now... I can't implement this. Apologies.

On GitHub: https://github.com/marius-sucan/KeyPress-OSD

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

ZIP Package compiled [x64 / x32]
http://marius.sucan.ro/media/files/blog ... mpiled.zip

CHANGE LOG:
v4.19.1 (2018-02-06)
- [new] it now checks if a new version is available before updating. Suggested by ozzii and others ;-)
- made small changes to how the language definitions INI file is generated

Binaries updated as well.

If you guys find any bugs, please let me know. Thank you.

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
My home page.
User avatar
Cerberus
Posts: 96
Joined: 12 Jan 2016, 15:46

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

Post by Cerberus » 06 Feb 2018, 16:26

Great script! I'm trying it for a while.
burque505
Posts: 580
Joined: 22 Jan 2017, 19:37

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

Post by burque505 » 06 Feb 2018, 18:21

Hi Marius, new version works fine, thanks!
Regards,
burque505
robodesign
Posts: 376
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
GitHub: mariussucan
Location: Romania
Contact:

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

Post by robodesign » 07 Feb 2018, 15:03

Hello!

Thank you guys!

Today's version is here:

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

v4.19.2 (2018-02-07)
- improved support for Bengali, Assamese, Devanagari, Hindi and other related writing scripts
- it now detects what kinds of keyboard layouts it supports or not [again, MANY THANKS @ drugwash]

Binaries not yet updated.

I will attempt to implement support for Arabic languages as well, from right to left typing [RTL].

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
My home page.
robodesign
Posts: 376
Joined: 30 Sep 2017, 03:59
Facebook: marius.sucan
GitHub: mariussucan
Location: Romania
Contact:

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

Post by robodesign » 08 Feb 2018, 13:13

Hello, guys!

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

v4.19.5 (2018-02-08)
- [new] partial support for Right-to-Left writing, for Arabic languages [thanks to drugwash for the RTL detection]
- [new] a window to list the currently installed keyboard layouts, instead of the Tray menu list
- further improved support for Indian writing systems
- removed the option to force a specific keyboard layout; there's nothing hard-coded, so this option/feature made no sense anymore

Many thanks to drugwash for his help!
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
My home page.
User avatar
Drugwash
Posts: 567
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania

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

Post by Drugwash » 09 Feb 2018, 06:35

off-topic: I wasn't notified of the above reply; was there any maintenance on the AHk server or is AOL acting up again? (spam folder is empty, spam is disabled)
I've deleted my CloudMe account because of GDPR - the now legal base for privacy invasion and data theft.
Post Reply

Return to “Scripts and Functions”