I am working on a macro – that can maybe evolve into a plugin – that can enter latin1 characters on windows. I have trouble with the unicode plugin. So I wanted to try this simpler approach.
On windows:
Hold down the left alt.
Press keypad 0
Press keypad 2
Press keypad 4
Press keypad 8
Release left alt
I get the “ø” character from the latin1 codepage.
This macro goes all the way back to my youth on DOS, where I knew the codepage by heart, so I could type many of the special characters, like german sz and all the table drawing characters.
Anyways. I am a Java guy. And I havn’t done any c++ in 20 years, so I make newbie mistakes.
I made one generic macro - that just goes crazy and gets the menu bar to blink in notepad.
I also made a hardcoded macro - to test my approach. That works, but in doesn’t just print one ø, it keeps printing until I unplug the keyboard.
I pushed my attempts to my github account.
Questions:
Why does the oe() macro not stop printing øøøøøøøøøø?
Can you see one or more problems with the generic latin1 macro? (input 248 for ø).
Just found this thread. That seems to hold the solution to my infinite ø problem
I’ll just try that out. But I’d still like to feedback on the generic latin1 macro.
pressKey() causes an extra HID report to be sent after a modifier is pressed, whereas pressRawKey() just adds it to the report. Some operating systems (or programs?) seem to fail to apply the modifier to keycodes that become active in the same report as the modifier (probably applying the modifier after registering the rest of the keycodes in the report). The delay didn’t help because no reports were being sent to the host in the interim.
I see you changed the delay to just 1 ms. Maybe that’s too short?
I would try changing the delay to 10 or 100, but you probably don’t need any delay between pressKey() and sendKeyboardReport() calls. If that doesn’t work, you could try to make it even more like actual keypresses by sending several reports:
I already tried 10 and 100 ms delays. That didn’t work - just made it slow and shaky. If I type fast it would mess up the ascii codes and different characters will show up!
But I’ll try the keyboard reports and see how that works.
So a keyboard report is what is sent when you hold down a key? I wonder how many is sent pr. second on a normal keyboard?
So @Jesse do you have any suggestions on how to emulate the key sequence more accurately than merlin og my suggestions?
Or do you have other suggestions as to why the sequence works when entered manually, but fails as a macro?