sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #22626
Re: [Question #240396]: need help on how to Key.DOWN in x times from a list
Question #240396 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/240396
Description changed to:
Hello,
How do I Key.DOWN x number of times?
Here is the sample script which I'm stuck in the while loop. Thanks!
import re, os
list_serial = ['0001-clothing-all','0001-clothing-men','0001-clothing-women','0002-clothing-all','0002-clothing-men','0002-clothing-women']
list_item = ['111-blouses','111-dresses','111-hats','111-pants','111-shirts','111-shoes','222-blouses','222-dresses','222-hats','222-pants','222-shirts','222-shoes']
myval1 = '0002'
myval2 = '222'
myserial = []
myarrow_down_serial = []
myitem = []
myarrow_down_item = []
for line in list_serial:
p = re.compile("(%s)(.*)"%myval1)
m = p.search(line)
if m:
sname = m.group(1)+m.group(2)
myserial.append(sname)
myarrow_down_serial.append(list_serial.index(sname))
for line in list_item:
p = re.compile("(%s)(.*)"%myval2)
m = p.search(line)
if m:
iname = m.group(1)+m.group(2)
myitem.append(iname)
myarrow_down_item.append(list_item.index(iname))
#['0002-clothing-all', '0002-clothing-men', '0002-clothing-women']
print myserial
#[3, 4, 5]
print myarrow_down_serial
#['222-blouses', '222-dresses', '222-hats', '222-pants', '222-shirts', '222-shoes']
print myitem
#[6, 7, 8, 9, 10, 11]
print myarrow_down_item
#comparelist = [x for x in list_serial if x in myserial]
#print comparelist
i = 0
while i < len(myserial):
# 1st run
# serial dropdown list has [1,2,3,4,5]
type(Key.TAB)
# tab down 3 times, which is first value in myserial
for line in myserial:
for nline in range(line):
#type(Key.DOWN, KeyModifier.CTRL)
print nline
# type(Key.TAB)
# item dropdown list has [1,2,3,4,5,6,7,8,9,10]
# tab down to 6, hold on shift and go down to 10, to select all value in myitem
# 2nd run
# tab down 4 times, which is 2nd value in myserial
# type(Key.TAB)
# tab down to 6, hold ctrl key, tab down to 8, so only 6 and 8 were selected only
# 3rd run
# tab down 5 times, which is last vaue in myserial
# tab down to 9, hold shift select 9, 10
i += 1
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.