need help on how to Key.DOWN in x times from a list

Asked by Ninja Mustang

Hello,

How do I Key.DOWN x number of times?

Question information

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

  for line in myserial:
       type(Key.DOWN*line, KeyModifier.CTRL)

--- Key.DOWN*line
this is not a valid parameter for type()

if you want to repeat keys with type(), you have to repeat the type():

  for line in myserial:
       for nline in range(line): type(Key.DOWN, KeyModifier.CTRL)

Revision history for this message
Ninja Mustang (ninjamustang) said :
#2

i got an error

for nline in range(line):
TypeError: range() integer end argument expected, got str.

also, i think i'm missing something since myserial list has 3,4,5 and the serial_list has 0,1,2,3,4,5. I need to key.DOWN 3 times to get to 3 and not sure what am I missing.

Revision history for this message
Ninja Mustang (ninjamustang) said :
#3

i got it, i indexed it so it worked.

only thing is when the list is large, it has to compare and take long time, i had to put wait(1) in between otherwise it just crashed.