tebelorg / RPA-Python

Python package for doing RPA
Apache License 2.0
4.96k stars 670 forks source link

Holding ctrl key while clicking - use r.vision('keyDown(Key.CTRL)') #546

Closed yekunhui closed 1 month ago

yekunhui commented 1 month ago

r.mouse('down') # hold the mouse down r.keyboard('[ctrl]') r.mouse('left') # release the mouse

Hi, I'm trying to do "hold the ctrl key and click something", but right now the best I can do is hold the left mouse button, press the ctrl key (not hold), and release the left mouse button.

Could you show me how to hold a key using the RPA?

kensoh commented 1 month ago

Hi @yekunhui you will have to use custom SikuliX commands with r.vision() see this example -

r.vision('keyDown(Key.CTRL)'); r.click('some_button.png'); r.vision('keyUp(Key.CTRL)')
yekunhui commented 1 month ago

Thank you, the issue is resolved!