How can i tell sikuli to hold a key while i see a certain picture

Asked by Wicked

Hi,

i need to hold the right key because i would like to slide a certain image out of the srceen.
I do this by doing:

while find( img ):
   type(Key.RIGHT );

But somehow the key.RIGHT is not holded, just tapped frequently.

Is there some other way?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Wicked
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

click() and type() per definition simulate a complete down/up operation.

nothing there now, to simulate what you want.

while find(): only means, that every time you get to the end of the while-loop, another find() is executed and tested. this means, that only the the time for the test and the op's inside are responsible for the time between to type()'s. add a sleep(3) inside, and the type() happens every 3 seconds.

Revision history for this message
Wicked (rikwilbrink+launchpad) said :
#2

Would be an interesting feature to have something like this hold(key, duration) function to simulate pressing keys... But ofcourse alot of stuff would be a nice to have.

Great project btw.