← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #163412]: Copy Multiple Login Details From A text file and Login?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
1) one of my hobbies - currently I have the time

2) before pasting around and running apps, you should assure, that the
basics are working

-- step 1: try this in a new script tab with an existing file
(C:\1.log.txt here), that contains some lines:

theFile = file(r"C:\1.log.txt")
for line in theFile:
    print line # prints the lines to the message area
theFile.close()

this should print the lines from your file in the IDE's message area

Take care: \ in strings has to be doubled/escaped as \\ or you use raw
string r"" (like i did here)

-- step 2:

your snippet:

# run("notepad.exe") # delete this, not needed
theFile = file(r"C:\1.log.txt")

App.focus("firefox.exe") # does not make sense inside the loop

for line in theFile:
#    paste line( ) # this is not Python
    paste(line) # this will paste at current cursor position in FF
theFile.close()

-- general comment:
If you have some errors, it would be helpful, to paste them here or at least name them, so I do not have to guess, what errors you might have had.

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