← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #402140]: Possible to repeat the same task but change one variable a field?

 

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

    Status: Open => Answered

Roman Podolyan proposed the following answer:
Sure it is.

Here is demo-code. 
______
print sys.path[0]
# Prints to console the directory script was launched in

f1 = open(sys.path[0] + '\\5lines.txt', 'r')
# Reads a file

strings = f1.readlines()

f1.close()

for line in strings:
    popup(line)
    #put your code here
_______

To demo it, create a Sikuli file with code like above, and text file with name 5lines.txt in the same directory with the lines you need
_____
First
Second
Third
Fourth
Fifth
______

After running this, I see 5 popups with strings from the text file.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.