← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #151185]: How to save the images in the script folder , if they are not referenced by direct names in the script

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Since you capture and name the images by hand in your script, just leave
the strings (thumbnails one per line) where they are after the capture.
If you like, you may move the strings to the end of the script and/or
form a tuple, to save lines.

--- e.g. one per line:
"page1.png"
"page2.png"
...
"page20.png"

--- e.g. as tuple:
("page1.png", "page2.png", "page3.png", .... , "page20.png")
after a comma a newline is possible if you want

--- If you name the tuple, your loop becomes even easier:
myImages=("page1.png", "page2.png", "page3.png", .... , "page20.png")
for img in myImages:
   click(img)

--- or if you need the counter:
for n in range(len(myImages)):
   click(myImages[n])
   if n == 7:
      # do something special

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