Is it possible to take screen shot during program execution

Asked by thomas

My query number 203478 will get solved if anybody can tell me how to take screen shots during program execution.

Help me...

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

# this will make a shot and store it in the folder, where the script is saved
import shutil
import os
dir = os.path.dirname(getBundlePath()) # the folder, where your script is stored
img = capture() # snapshots the screen
shutil.move(img, os.path.join(dir, "shot.png")) # to make it persistent

Revision history for this message
thomas (ramitdas2009) said :
#2

It requires manual selection of the region for screenshot. It is possible to automate the region for taking the screenshot like giving the coordinate or something within the program.

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

sorry, my fault.

But if you want to do more with Sikuli, it might be a good idea, to look through the docs ;-)

# this will make a shot and store it in the folder, where the script is saved
import shutil
import os
dir = os.path.dirname(getBundlePath()) # the folder, where your script is stored
img = capture(SCREEN) # snapshots the screen
shutil.move(img, os.path.join(dir, "shot.png")) # to make it persistent

Revision history for this message
thomas (ramitdas2009) said :
#4

Thanks RaiMan, that solved my question.