Pausing Vynk for now
Now that was quick – didn’t even last longer than my usual projects. The reason I’m pausing Vynk for now is because the java.awt.Robot class apparently isn’t able to send anything besides a subset of the ASCII charset characters to non-Swing windows.
Well… it is possible, but no one in their right mind would even think about using these workarounds. For Windows operating systems that would for example be holding down the CTRL-key and entering some fancy combinations on the numpad just to get an umlaut of some kind let alone accented characters.
Maybe I’m expecting too much – but I also couldn’t find any way to convert a character to a keycode so I could easily send it with java.awt.Robot. That’s why I ended up creating another ugly workaround to get the basic alphanumeric characters into a nice dictionary and additionally had to create a seperate dictionary for special characters so I could later access them easily.
KEY_EVENTS = dict((key[3:], value._doget(None)) for key, value in KeyEvent.__dict__.items() if key.startswith('VK_')) SPECIAL_CHARACTER_KEY_EVENTS = { ' ': KeyEvent.VK_SPACE, '!': KeyEvent.VK_EXCLAMATION_MARK, '"': KeyEvent.VK_QUOTEDBL, '#': KeyEvent.VK_NUMBER_SIGN, '$': KeyEvent.VK_DOLLAR, '&': KeyEvent.VK_AMPERSAND, ... } KEY_EVENTS.update(SPECIAL_CHARACTER_KEY_EVENTS)
But even with all that I’m still not able to send simple umlauts, such as ‘ü’, ‘ä’ or ‘ö’ to non-Swing windows or even a simple ‘?’ for that matter. Maybe I’m doing something completely wrong and it’s all my fault or just maybe java.awt.Robot isn’t as well-kept as the other Java libraries… or I simply don’t get Java. It’s probably a bit of everything.1
If I ever start working on it again I’ll probably use python-xlib. Of course it wouldn’t be cross-platform then anymore, but really, it’s not like Windows is in any need of desktop automation software with stuff like AutoIt and AutoHotKey around.
1) If anyone knows how to do these things contact me please or simply leave a comment.
