← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #642404]: Read lines from a file and pause for hotkey?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
for line in theFile:
  while running:
      print line # print line in sikuli
      click("1330680438453.png"), type(line)

will not work, since the while loop will repeat with the first line
until running gets False.

for line in theFile:
  if running: # check wether hotkey was pressed
      print line # print line in sikuli
      click("1330680438453.png")
      wait(0.5) # this depends on how fast your GUI reacts
      type(line) # paste() is needed if line contains special characters or even non-ASCII 
      wait(5) # see comment

comment: when a line is processed, the script should wait some time to
give you a chance to observe and react ;-)

without

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