← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #288410]: How can I save screenshot as "system date.png"

 

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

Description changed to:
I have written a code on sikuli  where, when my scripts fails it has to take a screenshot with current system date and time
 *The problem I am facing here is I want to save the screenshot with current system date and time*


Following is my code:

some_region=SCREEN
img = capture(some_region)
from time import strftime
a=(strftime("%Y%m%d"))
print a
now = time.localtime()
b=(str(now.tm_hour)+":"+str(now.tm_min))
print b;
filename = a + b
print filename
screenshotsDir = "C:\Users\sucheta\Desktop\screenshots"
shutil.move(img, os.path.join(screenshotsDir, "error.png"))

In the above code instead of saving the screenshot as error.png I want
it to be saved as filename.png

Please help me out.

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