Before to start

As emerged by discussing this topic, the best practice about offscreen windows is to simply avoid them if you can. So this page attempts to list the best practices to use when you just have to use offscreen windows. Following there is a list of pros and cons of offscreen windows as emerged in the discussion:

Cons:

Pros:

Offscreen Windows

Every time a script is supposed to do something more than just update a couple of fields in the current record, I like to make it work in its own window (often off-screen to improve the user experience). One problem with the windows is that you have to remember to close them at every exit point of your script, otherwise your solution will accumulate tens (at best) of off-screen windows. I'm using a couple of practices that I found helpful in the everyday work:

These are practices that I'm constantly using but they are far from refined; for instance I was thinking about a custom function to generate a unique script instance identifier (something like script name & timestamp & random number) that could be useful for debug/log purposes (with recursive script calls too) and also usable as a title for their working windows, but at the moment the techniques I described above are enough for me.