I have a number of windows and I'd like to tile them to cover the entire workingarea of the screen. If there are less windows, the individual windows are bigger. The windows are almost squares -- an example is 800x585. They always scale with a fixed ratio.
In this example I only have 4 windows, so my calculation should figure out that filling the screen is done with a 2x2 grid.
In this example I have 8 windows, but instead of 4 cols x 2 rows (which would leave a huge gap underneath the 2nd row because of the fixed ratio) the windows are divided in 3x3 with one empty spot.
The basic idea is to leave as little uncovered screen space as possible. I'm trying to do this in AutoIt, but if someone can explain this in C# or Python I am equally happy :)