I am using Keyboard global hook library in Python (https://github.com/boppreh/keyboard) to simulate key pressing in other applications (during text entry I am replacing accents on words).
Everything works fine for simple combinations such as 'ctrl+c' or 'ctrl+v', but I also need to simulate a bit more complex combinations, most importantly 'ctrl+shift+left', which is essentially a 'ctrl+shift and left arrow key' on the keyboard (to highlight the last word in text).
Does anyone know how to do this in Python using above library? Or even without the library?
Currently I do something like this, to first press ctrl+shift, keep it pressed, then pass left arrow key and then release ctrl+shift:
keyboard.press_and_release('ctrl+shift', True, False)
keyboard.press_and_release('left', True, True)
keyboard.press_and_release('ctrl+shift', False, True)
But for some reason this doesn't work, it doesn't highlight the last word in text. Same as this, which also doesn't work:
keyboard.press('ctrl+shift+left')
Nor this:
keyboard.send('ctrl+shift+left', True, False)
keyboard.send('ctrl+shift+left', False, True)
Any ideas how to get this working?