boppreh / keyboard

Hook and simulate global keyboard events on Windows and Linux.
MIT License
3.77k stars 433 forks source link

Libreoffice Impress remote control #514

Closed DDS9 closed 2 years ago

DDS9 commented 2 years ago

Hello, I experience a problem when sending slide numbers to Impress, trying to remote select the slide no?

keyboard.write( str(pageImpress), 0.1, True, None ) time.sleep(0.1) keyboard.send('enter')

Tested this with Notepad (Win10x64) and it works fine. Is Impress not processing number entry?
You can hand type the slide no and Enter and Impress jumps.

If there is a better way to send from Python to select the slide I would like to know.

Target platforms are Windows10 and RPI4 when working.

DDS9 commented 2 years ago

Solved! Use press() and release() one character at a time. ps = str(pageImpress) delay = 0.05 for x in ps: keyboard.press(x) time.sleep(delay) keyboard.release(x) time.sleep(delay) keyboard.send('enter')