Closed fregapple closed 1 year ago
Also. Is there a way I can either
1) use keycodes for hotkeys. I have tried using:
hotkey = keyboard.HotKey(keyboard.HotKey.parse('<68>+<160>'), test)
This will parse properly, however hitting the hotkey will not do anything. If I change it to ..('d+
2) If I can not use keycodes like that. Is there a way I can convert the keycode back to char. EG <68> to 'd'.
Thank you for your report.
I have tested your script, and I can reproduce your issue. If I remove the call to os.startfile
, however, the script works as expected with regards to hot-keys. By adding logging to the pynput code I have verified that the release messages are never delivered.
As noted in the documentation, the listener callbacks should not perform any long running code, and process creation is such a case on Windows. The documentation should be clarified. The documentation linked contains a suggestion for how to work around this limitation.
HI!
I am trying to make a script that can load hotkeys from a json file. I have it working as expected, however, keys get stuck and produce weird behavior.
if JSON file were to be:
and Code to be:
So to be precise, If I press windows + alt + h, it will open the text file. However, what then seems to happen is that the 'h' is stuck pressed. This causes an issue as if I press windows + alt again, it will just open the text file.
THEN if I pressed windows + alt + n, it will open Event Viewer AND the text file. To which if I press Alt + Windows again, it will open them both!
The only way to stop this, is if I press h after I press the hotkey combination.
While typing this out, I have constructed a temporary fix:
It isn't an ideal solution, but any insight on why it is getting stuck in the first place would be great!!!
Thanks