[SIKULI-JAVA] How to create a BufferedImage on the ActiveWindows

Asked by Jerome

Hi,

I would like to know if it's possible to set a BufferedImage with the ActiveWindow of a screen (on java with the lib sikuli-java)

details :
I don't know the location of the activeWindow and I don't know the content of the activewindow (it could be a browser, an explorer,...)

Thanks

Jerome

P.S : I work with eclipse with a jre7

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
Best RaiMan (raimund-hocke) said :
#1

Region win = App.focusedWindow();
should do what you want.

to get the buffered image this should work:
BufferedImage bing = (new Screen().capture(win)).getImage()

Revision history for this message
Jerome (jloge83) said :
#2

Thanks Raiman, that solve my problem