Вопрос

I have a small application that listens to keystrokes on a windows machine and sends them to a mac over a socket connection (python). The mac then emulates the key presses using 'osascript to send key code..'.

What I'm struggling with is the windows key codes are different from the Mac. Windows codes: http://cherrytree.at/misc/vk.htm Mac Codes: http://www.fischer-bayern.de/phpBB2/viewtopic.php?t=1967

Is there any simple way of mapping one key-code to another? I'm guessing a lookup table could work, anyone know of anything in existence before re-creating the wheel?

In the perfect world I want something like:

mackeycode = win2mackeycode('54')
Это было полезно?

Решение

There is this lookup table that may be handy: https://gist.github.com/willwade/5330474

And the Python answer seems to be https://github.com/SavinaRoja/PyUserInput but needs completing for the Mac :)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top