Take screenshot without clicking

I use this code to take screenshots, but it requires user to click once to window. I would like my script to click window once so it takes shot without user click.

I have tried various codes found from this forum, but nothing seems to work. Extra Suites is not compatible with my computer.

do shell script “screencapture -Wimxo " & quoted form of (”/Users/" & (system attribute “USER”) & “/Pictures/Shots/shot.png”)
–click once

I needed the same functionality some time ago and came up with this solution. Maybe it can also be of some use for you?

Thanks i can use it some of my scripts, but this script cannot use cropping etc.

Simple click like this should not be this difficult.

Is the intention to only capture a window, or the whole screen?

Only one window, thanks.