How to use Alt-PrintScreen keys on capture(Screen()) command?

Asked by CCIOLA

Hey guys, I have this function to take screenshots:

def captureImage():
    captureScreenshot = shutil.move(capture(Screen()), screenshotsDirectory + 'NameOfImg_' + (str(int(numPrint))) + '.png')

But it takes screenshot of the whole screen. I want to capture only a window, using something similar as Alt+PrintScreen keys.

Can I use something like this on (capture(Screen()) command?

Regards,
Carol Ciola

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
CCIOLA
Solved:
Last query:
Last reply:
Revision history for this message
masuo (masuo-ohara) said :
#1
Revision history for this message
CCIOLA (carol-ciola) said :
#2

Thanks, masuo! Worked pretty good!

firstWindow = App.focusedWindow()
firstWindow.highlight(2)

def captureImage():
    captureScreenshot = shutil.move(capture(firstWindow), screenshotsDirectory + 'AppVdlkAndroid_' + (str(int(numPrint))) + '.png')

Revision history for this message
masuo (masuo-ohara) said :
#3

That is great, CCIOLA.