How to display a pressed key?

Hello.

I have two Mac's with synchronized KeyBoard Maestro application.
Keyboards (within System Preferences) seems to be the same.

I developped a macro with hotkey trigger = F12:

  • on the iMac, it's ok
  • one the Mac Book air, it doesn't work but when I press shift-F12, it works
    I don't understand :sob:

An idea ?

Within KM, is-it possible to 'display' the pressed key ?

Thanks in advance

Hi @Filou. Take a look at the macro below. It is disabled when you import it, so make sure you enable it first (tick the "Triggered by any of the following" checkbox). This is an example of how you can display the pressed key. The important part is the token %TriggerValue% that returns information about the current macro's trigger, when the macro runs.

You can use that token in anything really, but I've chucked it into a Display text briefly action so that it shows a system notification. Changing the options in the dropdown within the action can give you other results. You could also use the trigger value for things other than just display if that would be useful for you.

display key.kmmacros (1.4 KB)

2 Likes

Hi Vincent.
Super: it works on the iMac...
I'll go to test it on the Mac Book Air.
Thanks a lot.

Phil

As I hoped it the macro works also on my MacBook Air... 'ouf !'
But, with F12, I obtain no response ...
(shift-F12 is ok, thus I think that the hardware key is ok)

I suppose that there is a conflict with another application but which ?
How to identify it ...
I'll go to examine each loaded application... and system preferences/keyboard

On the MacBook, press F12. Then go to KM, select All Macros in the Group column, then choose View > Sort Macros by > Date Used. If there is anything that F12 activates within KM, then it will appear near the top of the list in the Macros column.

Nice idea Thoffman666...
I tryed it but no significative result.
:sweat:

Thanks

Are you using the fn key to make sure that it is actually F12, not raise volume?

Yes, on both machines...

Here is my macro:

My goal is just to display / hide nvALT* using F12 as a toggle
(and if nvALT is not running, I launch it)

I added

  • the display of the trigger key (as suggested by vincent_ardern)
  • the display of a message (1-2-3-4) to trace the exceution

On my iMac, it works nice,
on tthe MBA, it beeps and stop at step 2.
I suppose it doesn't treat the F11 key

'Bizarre, vous avez dit bizarre...?'

(nvALT is a super tool to take notes quickly. see more details on https://brettterpstra.com/projects/nvalt/)

Today, I created a new user on the MBA to test the macros from scratch...
Same problem ! :frowning:
The issue seems therefore to be

  • within the macro ?
  • or due to the passage from High Sierra to Mojave ?

???

I recreated your macro and I also get the beep (on an iMac with macOS 10.15.2 and KM 9.0.4). To me it seems that nvALT somehow doesnā€™t get the F11 keystroke from KM.

This was my test macro: [test] NValt (Filou).kmmacros (3.6 KB)


But why arenā€™t you doing it just like this?:

46-pty-fs8
[test] NValt (alternative version).kmmacros (2.1 KB)

No need to setup a hotkey in nvALT, since the KM action brings nvALT to the front if itā€™s running, and if itā€™s not running it will launch it and bring it to the front.

ā€¦unless Iā€™m missing something.


By the way, if you uploaded your macro, it would be easier for others to quickly test your macro. Recreating a macro from a screenshot, even if itā€™s simple, always takes a minute or more. Uploading a macro takes you 10 seconds :wink:

2 Likes

Hi Tom.
Thank you for the test
(and sorry for the inconvenience, i'll try to upload the macro the next time).
I have no more time to response today. It will be for tomorrow... Sorry again

Hi Tom.

I tryed your alternative macro and some other things, without complete success.

But I think that I have now the 'explanation'.
As of today, I used nvALT with the the option 'Hide Dock Icon' (in the prefs of the application).
Today, I tryed it without that option and...
tadam ... it works on both MBA & iMac ! :smile:
I don't understand exactly Why but it works.

Thank you all for your help

PS:
in your alternative version, I just changed "if already at the front - Leave it at the front" -> "Hide the application" (to obtain the toggle display effect)

Yep, correct. With this the single KM action should do exactly what nvALTā€™s integrated shortcut is doing, with the additional benefit that it launches the app if it is not running.