glitchassassin / lackey

Lackey - Graphical desktop automation with Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

genequ opened this issue · comments

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.

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

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

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

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