glitchassassin / lackey

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

type(Key.RIGHT, Key.SHIFT) does not work as expected #143

Open genequ opened 5 years ago

genequ commented 5 years ago

Windows 7, Lackey 0.7.3

It does not work when sending arrow keys (LEFT/RIGHT/DOWN/UP) and Key.SHIFT when Num_Lock is ON which is expected to select a line, e.g, type(Key.RIGHT, Key.SHIFT), it just moves the cursor but does not select anything.

Sikuli seems has the same problem, but user can get the Num_Lock state via Key.isLockOn(Key.NUM_LOCK) and workaround, https://answers.launchpad.net/sikuli/+question/143874 Unfortunately, this API does not work in Lackey.

RaiMan commented 5 years ago

In SikuliX I use this hack by accessing the Windows API directly to get the real state of the respective lock key: / Windows lib user32 https://msdn.microsoft.com/pt-br/library/windows/desktop/dd375731 VK_NUM_LOCK 0x90 VK_SCROLL 0x91 VK_CAPITAL 0x14 int state = GetKeyState(LockKey); / Hope it helps. RaiMan from SikuliX

genequ commented 5 years ago

Thanks RaiMan! Now i use win32api.GetKeyState(0x90) to get the Num Lock state

glitchassassin commented 5 years ago

This will require some work on the keyboard library. There's an issue open for this enhancement. I'll review this for a contribution.

glitchassassin commented 5 years ago

I've submitted a pull request to the keyboard library that will let us add this feature to Lackey as well.