How to watch a screen and make screenshots of regions

Asked by Sharepoint User

I'm writing a test procedure and would like to watch a region. When the region changes I'd like to copy screen shot of the region and put it into a directory on my PC.

Is there a example of this online I can review?

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
j (j-the-k) said :
#1

Try this:
import shutil

def changeHandler(event):
    shutil.copyfile(capture(event.region),"C:\\my\\dir")

reg = Region(0,0,500,500)
reg.onChange(50, changeHandler)

reg.observe(500)

You only have to replace "C:\\my\\dir" with your target image directory, Region(0,0,500,500) with the region you want to observe and set the number in observe() to the number of seconds you want your script to observe the region.

If you have any more questions, please aks :-)

Can you help with this problem?

Provide an answer of your own, or ask Sharepoint User for more information if necessary.

To post a message you must log in.