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

    Status: Open => Answered

RaiMan proposed the following answer:
Writing back in the same file is rather complex (if you want to stay
with one login per file, use option "a" for append instead of "w+").

But to have more options to go in the future:
In these cases, you should use your input file read only, and write everything 
to a new file (something like logging).
If you really need it to be the same filename, you might either rename it 
afterwards by hand, in the .cmd when running from command line or even from 
inside the script (see features of Python modul shutil).

so, I would do it this way (see comments in the code)

find("1331025509166.png")
click("AY7.png");wait(5)
import array
arr=[]

f=open("C:\ccccc\login.txt","r")
fout = open("C:\ccccc\login-results.txt","w") 

for line in f.readlines():
    arr.append(line.strip()) # get rid of newline
f.close()

# this block could even be repeated
# with more than one login from file
find(Pattern("1329984936713.png").targetOffset(104,29));wait(1)
click(Pattern("1329984936713.png").targetOffset(104,29))
type(arr[0])
wait(1)
find("Fusswurd.png");wait(1)
click(Pattern("1329985178218.png").targetOffset(95,30))
type(arr[1])
click("Login.png")
# How do you check, wether login was successful?
fout.write("%s\n%s\n%s\n"%(arr[0], arr[1], "Login is successful")
# end of block

fout.close()

-- 
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     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to