← Back to team overview

sikuli-driver team mailing list archive

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

 

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

I'd like to iterate through lines in from a file. Using each line to paste or type that line into an application.
I'd then like to wait for some interaction perhaps via a hotkey.

I've managed to find this example code to read through a file.
Also I've found how to handle a hotkey with a while loop

Putting it all together I have something like...

running = true
def runHotkey(event):
	global running
	running = false

Env.addHotkey(Key.NUM4,0, runHotkey)

theFile = file(r"F:\Office\Script\sikulitestfiles\Text.txt")
for line in theFile:
  while running:
      print line # print line in sikuli
      click("1330680438453.png"), type(line)
theFile.close()

Does this look ok / safe ?

Thanks in advance.

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