Okay. This one is a little tricky, because setting the Document Window is one of those actions that Python is not allowed to do, for some stupid reason! So I had to sneak in through the back door by writing and loading a little PZ2 file. Since PZ2 only works on a figure, this script will only work if you have a figure somewhere in the scene. Doesn't matter which figure, and doesn't matter which one is selected; just has to be a figure. I suspect that all of your scenes include a figure. If you have a bunch of figure-less scenes, I'll have to add another back-door trick.
My python page
My ShareCG freebies