New question #240396 on Sikuli: https://answers.launchpad.net/sikuli/+question/240396
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)) # serial_list = [1,2,3,4,5,6,7] # item_list = [1,2,3,4,5,6,7,8,9,10,11,12] # myserial = [3,4,5] # myitem = [6,7,8,9,10] i = 0 while i < len(serial_list): # 1st run # serial dropdown list has [1,2,3,4,5,6,7] type(Key.TAB) # tab down 3 times, which is first value in myserial for line in myserial: type(Key.DOWN*line, KeyModifier.CTRL) type(Key.TAB) # item download list has [1,2,3,4,5,6,7,8,9,10,11,12] # 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, 11 i += 1 -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. _______________________________________________ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp