glitchassassin / lackey

Lackey - Graphical desktop automation with Python
MIT License
616 stars 75 forks source link

Error when typing ALT key on Mac #142

Closed genequ closed 5 years ago

genequ commented 5 years ago

macOS 10.12, Lackey 0.7.3

type(Key.ALT) [action] Typing '{ALT}' with modifiers 'None' Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/site-packages/lackey/RegionMatching.py", line 918, in type kb.type(text, typeSpeed) File "/usr/local/lib/python2.7/site-packages/lackey/InputEmulation.py", line 365, in type keyboard.press_and_release(self._SPECIAL_KEYCODES[special_code]) File "/usr/local/lib/python2.7/site-packages/keyboard/init.py", line 381, in send _os_keyboard.press(scan_codes[0]) IndexError: tuple index out of range

RaiMan commented 5 years ago

I guess, lackey does not allow to "type" special keys like ALT, CTRL, SHIFT or CMD (but I may be wrong ;-) Normally they are used in combination with normal keys as so called modifiers. You have to check the lackey API docs. RaiMan from SikuliX

genequ commented 5 years ago

Thanks for the comments @RaiMan I encountered the problem when using type('t', Key.CMD+Key.ALT), then narrowed down it is caused when sending Key.ALT. It occurs when using any combinations with ALT. No problem for CMD and SHIFT etc.

glitchassassin commented 5 years ago

I've replicated this on my end; it appears to be an issue with the underlying keyboard library. I'll review and submit a patch.

glitchassassin commented 5 years ago

Fix has been pushed to the keyboard master branch.