sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #06647
Re: [Question #177654]: Stop a loop
Question #177654 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/177654
RaiMan proposed the following answer:
yes of course, it is complicated ;-)
The challenge will be, to synchronize the current folder in the app
(which is managed by clicking) with the programmatical evaluation of the
directory content (needs to know the folder name).
But pls. accept, that I cannot make your script, that is your job.
This is an example, that walks through a directory structure and allows
to select specific folders with a regular expression:
import os
import re
dir = "absolute-path-to-top-folder"
# make sure: trailing \
num = numv = 0
def wvisit(arg, dir, names):
global num, numv
num += 1
if re.match(arg, os.path.basename(dir)):
numv += 1
print "*****", dir
for f in names:
print f
# here you would filter your jpeg's
# and you might click in your app
os.path.walk(dir, wvisit, "") # all folders/subfolders including top
print "folders actually visited:", numv, "out of:", num
os.path.walk(dir, wvisit, ".+") # same but without top
print "folders actually visited:", numv, "out of:", num
os.path.walk(dir, wvisit, "test") # all Folders beginning with test
print "folders actually visited:", numv, "out of:", num
os.path.walk(dir, wvisit, ".*test") # all Folders containing test
print "folders actually visited:", numv, "out of:", num
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.