← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #156242]: Use for-loop to observe screen

 

Question #156242 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/156242

Calle Rundgren gave more information on the question:
Think I worked the best way to avoid too many if-statements now. 
I am using two lists, one with the wrong-messages and one with the success-messaage(s). 
Im happy with this solution now, but if anyone have a better one, feel free to make a input...! 
Still I am using the if-statement but I managed to keep the amount of statements low. 

list1(image1, image2, image3, image4)
list2(image1, image2)

if exists(list1[0] or list1[1] or list1[2] or list1[3]):
     popup("Failed")
     type(Key.ENTER)
     #Some code that restart the test. 

if exists(list2[0])
     #code who starts the next test.

if exists(list2[1])
     #code who tells this was the last test.

Add to the question: If i want to store some logg info in a text file,
is this the best way? When I tried to run it inside a if-statement it
didn't work. I am not recieveing any messages that it did not work.

file = open("Full way to the file", "r")
filedata = file.read()
file.close()

newLine = "InDataForTextFile.\n" + 
filedata
file = open("Full way to the file", "w")
file.write(newLine)
file.close()

TYIA
Calle

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.