type(Shift + Down Arrow) does not work as expected

Asked by maxpundi

Hi,
I desperately read (but not understood all of them) many of related posts . . .
I'm not a programmer and just want to send Shift + Down and Enter.

Could someone be kind enough to write it as an example, so anyone reading this post later on could use your coding example as a base to elaborate.

This is what I wrote :
if exists(Image):
 click(Image)
 type(Key.DOWN, KEY_SHIFT) #and I tried many, many more combinations, without success . . .
 type(Key.ENTER)

Thank's in advance for your help.

Question information

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

it is correct.

I guess it does not happen what you expect. Might be a timing problem:

After the click your target app needs some time to prepare for keyboard input acceptance - the type comes too fast.

Try this:

if exists(Image):
 click(Image)
 wait(1) # or even longer
 type(Key.DOWN, KEY_SHIFT) #and I tried many, many more combinations, without success . . .
 type(Key.ENTER)

After you get it working, you might reduce the waitiing time to the minimum needed - if necessary for speed ;-)

Timing problems in the combination of mouse and keyboard actions is one of the most overseen challenges with Sikuli.

Revision history for this message
maxpundi (nulcihc) said :
#2

Hi RaiMan,
Thank you for your very fast answer.
;-)
It is a monthly login for social help.
As I did the whole routine by hand, not expecting such a fast answer, I'll have to wait until next month to retest and modify it.
I'll follow up next month tho.
Many thanks and All the Best.

Can you help with this problem?

Provide an answer of your own, or ask maxpundi for more information if necessary.

To post a message you must log in.