willwade
willwade

Reputation: 2220

Key codes converting from windows to Mac

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')

Upvotes: 2

Views: 2931

Answers (1)

willwade
willwade

Reputation: 2220

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 :)

Upvotes: 1

Related Questions