[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

23 Dec 2017, 17:25

Wow, thank you so much! I will implement these as soon as holidays end.
-------------------------
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

24 Dec 2017, 04:52

You're welcome. Merry Christmas, Happy Holidays and so on! :D
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

24 Dec 2017, 04:53

@drugwash:

I changed EnumFonts to:

Code: Select all

EnumFonts() {
    hDC := DllCall("GetDC", "Ptr")
    hDesk := DllCall("GetDesktopWindow", "Ptr")
    Callback := RegisterCallback("EnumFontsCallback", "F")
    DllCall("EnumFontFamilies", "Ptr", hDC, "Ptr", 0, "Ptr", Callback, "UInt", lParam := 0)
    DllCall("ReleaseDC", "Ptr", hDesk, "Ptr", hDC)
}
and now, no fonts are listed in the dropdown. Did I do something wrong?

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

24 Dec 2017, 05:47

Code: Select all

EnumFonts() {
    hDC := DllCall("GetDC", "Ptr", hDesk := DllCall("GetDesktopWindow", "Ptr"), "Ptr")
    Callback := RegisterCallback("EnumFontsCallback", "F")
    DllCall("EnumFontFamilies", "Ptr", hDC, "Ptr", 0, "Ptr", Callback, "UInt", lParam := 0)
    DllCall("ReleaseDC", "Ptr", hDesk, "Ptr", hDC)
}
You're failing at GetDC because you didn't feed it any valid parameter. It needs a window handle, which should be the hDesk that you're retrieving after calling GetDC() not before as it should. Try my code above, it'll work. Or if you wanna do it step by step:

Code: Select all

EnumFonts() {
				hDesk := DllCall("GetDesktopWindow", "Ptr")
    hDC := DllCall("GetDC", "Ptr", hDesk, "Ptr")
    Callback := RegisterCallback("EnumFontsCallback", "F")
    DllCall("EnumFontFamilies", "Ptr", hDC, "Ptr", 0, "Ptr", Callback, "UInt", lParam := 0)
    DllCall("ReleaseDC", "Ptr", hDesk, "Ptr", hDC)
}

You'll have to become familiar with the Windows API, the (way too many) data types, how to correctly call the APIs in AHK and what return types to specify when needed. ;)
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

24 Dec 2017, 06:54

Hello, followers!

Today's new release is here:

v3.87 (2017-12-24)
- various bug fixes
- new keyboard shortcuts; see help;
- changes to the files structure and organization; now it's per folders
- implemented Help: Presentation, Keyboard Shortcuts and Features

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

AHK_H v1.1 is required to run it.

@burque505 and @drugwash: Many thanks!! Merry Christmas to both of you.

@drugwash: I am not good at DLL calls, sorry, hehe...

The bug was still there, with the GUI and weird values. Round() was not enough. Today I hope I fixed it for good.

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

24 Dec 2017, 07:22

Error downloading language file. You forgot to create the required folder before downloading - it will not be created automatically.
20171224141501.png
20171224141501.png (15.52 KiB) Viewed 2398 times
After manually creating the folder and relaunching the script (plus checking for updates from tray menu) it downloaded everything correctly.

No worries, we all learn as long as we live. In time you'll come around, with DllCalls and everything else. ;)
Thanks for the good wishes! :wave:
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

24 Dec 2017, 18:25

Merry Christmas, you guys (still the day before over here :xmas: ).
I wasn't able to get the files downloaded. I created the keypress-files folder since I got an error at line 281 about 'keypress-files\keypress-mouse-functions.ahk', but the script won't start, so I can't update.
Anyway, Marius, thanks for all your hard work, Dragoș, you too, talk to you both after the holiday.
Regards,
burque505
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

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

25 Dec 2017, 05:01

Thank you very much, burque and sorry you got such problems, hopefully it'll all be sorted out soon. ;)
Happy Holidays to you too! :wave:
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

25 Dec 2017, 05:04

Hello, guys!

I worked now on the bugs you reported... I hope I fixed now those files handling errors. Version is 3.87.1.

Thank you very much.

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

25 Dec 2017, 06:54

Download went smoothly this time, no errors. Good job, you deserve a glass of palinka! :D
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

25 Dec 2017, 07:56

Lol, drugwash. Thanks, but my stomach can't handle that, hehe.

Great it worked now.

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

25 Dec 2017, 08:45

Deleted everything in the folder just to make sure. Downloaded smoothly here also and EVERYTHING is working so far. I haven't changed any of the default settings.
Bravo! Crăciun fericit! Sărbători fericite!
I never noticed this till today, but the OSD also shows the contents of the clipboard if pasted. Cool!
All the best,
burque505
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

25 Dec 2017, 09:04

Hey, burque505!

That's AWESOME to hear!!! Does this include the dead keys? do they work fine? ;-) I am just asking to make sure.

Happy and excellent holidays to you too!

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

28 Dec 2017, 12:41

Hello, guys!

A new version is here:

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

Please use AHK_H to execute this script.

v3.90 (2017-12-28)
- [new] option to show a ripple effect on mouse click
- the script is by MrRight, from 2015; from https://autohotkey.com/boards/viewtopic.php?t=8963

v3.89 (2017-12-27)
- [new] option to have it play DTMF signals for numpad keys

v3.88 (2017-12-26)
- [new] option to set KeyPress to start at boot
- [new] new option: Distinct beeps for different key groups
- improvements for key beepers
- various bug fixes

As you can tell already, a lot of work went into keyboard beepers. Next, I plan to finish Help pages.

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

29 Dec 2017, 15:34

Hi Marius, v3.90 is working great for me in Spanish. In Romanian, the number keys don't display on the OSD, but the numpad numbers display just fine. „ and ” display fine in both the app and OSD, however.
No trouble with Russian so far at all. In German, ´´ is killed both in the app and the onscreen display, everything else appears to be working. As far as I can tell, Ukrainian is 100%.
Regards,
burque505
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

29 Dec 2017, 16:11

@burque: Thank you very much for the report.

Once you activate "Do not bind dead keys", ALL dead keys are considered. Romanian layouts have dead keys with AltGr. To ensure those work, they are not bound. All the numbers are dead keys with AltGr. Please disable AltGr support, to get the numbers row working again.

Please let me know if this is the case. And... Which German layout do you refer to?
Please update me on this.

PS. I'll add a message box to inform users about this when they deactivate dead keys binding.

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

30 Dec 2017, 03:32

AltGr is used for other characters too, not only for dead keys, so killing AltGr support will cripple the keyboard. See here.

Sorry I didn't have time to test the new version being busy with my own scripts.
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

30 Dec 2017, 05:00

Hello, guys!

Yes, that is correct. Today's new version corrects this:

v3.90.5 (2017-12-29)
- [new] distinct option to ignore/not bind dead keys with AltGr, at Typing mode settings window.
- [new] menu item: Troubleshooting. :-)


@burque: please test this version without enabling Do not bind dead keys. The dead keys should work now without having to enable that. Please let me know. I recently made some underlying changes that affect dead 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.
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

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

30 Dec 2017, 11:20

Hi Marius,
I started with your instructions (Do not bind dead keys).
On kbd0407 (German), what is +/= on the US keyboard should add an accent (i.e. convert 'e' to 'é'). But what happens is the first time you press it, you get " e " in the app. The next press, you get " ``e ". The next press you get " e " again. Romanian had the same problems as before.

Then I enabled "Do not bind dead keys". Romanian appeared to me (and I'm the wrong person to ask about that, really :) ) to be working just fine. In German again, the accents work fine in the app but don't appear in the OSD.

Regards,
burque505
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

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

31 Dec 2017, 06:18

Hello!
@burque505: Major changes to the dead keys support. Please update to the latest version and deactivate "Do not bind dead keys". The new version of AHK fixes some bugs related to hotkeys and it made imperative that I change how I handle dead keys, quite much. I hope they work now. Please let me know. Happy new year!

Today's new version is here:

by Marius Sucan (robodesign.ro)

v3.91 (2017-12-31)
- AHK_H v1.1.27 fixes. All dead keys are now defined only by VK. No hard-coded names/symbols anymore. They are all identified at start.
- [new] OSD preview. Facilitated customization by implementing a preview window when user customizes the appearances at "OSD appearances" settings window.

Download AHK file from or use the Update now option:
http://marius.sucan.ro/media/files/blog ... ss-osd.ahk
Please use AHK_H v1.1.27 to execute 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.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: Kobaltauge, laoyugong and 143 guests