sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #04932
Re: [Question #169023]: Currently running application title needed
Question #169023 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/169023
Status: Open => Answered
RaiMan proposed the following answer:
If you need information on files just use the appropriate standard Python modules, that are available in Sikuli script.
Here is an example, that finds the most recently updated file in a directory.
more info: http://www.jython.org/docs/library/os.html
import os
dir = "absolute-path-to-your-folder"
files = os.listdir(dir)
latest = 0
file = ""
for f in files:
full = os.path.join(dir, f)
info = os.stat(full)
t = time.strftime("%Y-%m-%d", time.localtime(info.st_ctime))
if t > latest:
latest = t
file = full
print file, latest # here you have your file
import shutil
shutil.copy2( file , r"d:\newname" ) # incl timestamps
--- your OCR solution
if you want to read text from the screen, you first should make a test, wether this works reliable for your font.
print selectRegion().text() # run and select the appropriate region on screen
if you decide to use the OCR feature: the easiest way is to calculate the region, that contains the text and then say
text = reg.text()
the region should have a margin of about 2 pixels around the text.
there are many options to get the region. one option always is to
calculate/measure offsets to known visual objects already found.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.