You just have a typo
Code:
nXpos:Set["1920-${Xsize}"]
should be
Code:
nXpos:Set["1920-${nXsize}"]
the variable is nXsize. 
Also, ${clients} is equal to ${Sessions}+1 (it holds the number you gave originally, the number of clients that should be open at the time this code is run, by Zanthor's design). You can make the script work for any resolution by changing your hard-coded 1900 and 1200 values to ${Display.Width} and ${Display.Height}, and work on multiple monitors by adding ${Display.DesktopX} and ${Display.DesktopY} to the X,Y position -- so if you change your configuration later or if someone else wants to use the same script, they can.
So, here is my recommendation for you and people who want your exact layout:
Code:
function main(int clients)
{
while ${Sessions} < ${clients} - 1
waitframe
variable int nSession
nSession:Set["${Session.Right[-2]}"]
variable int nXsize
variable int nYsize
variable int nXpos
variable int nYpos
variable int nVertSplit
nVertSplit:Set["${clients}"]
/* with less than 5 clients, the pip windows will be pretty big, so set this to 5 minimum */
if ${nVertSplit}<5
nVertSplit:Set["5"]
nXsize:Set["${Display.Height}/${nVertSplit}"]
nYsize:Set["${Display.Width}/${nVertSplit}"]
nXpos:Set["(${Display.Height}-${nXsize})+${Display.DesktopX}"]
nYpos:Set["(((${nSession}-1)*${nYsize})%${Display.Width})+${Display.DesktopY}"]
run windowsnapper -pos ${nXpos},${nYpos} -size ${nXsize}x${nYsize}
windowpos -viewable 0,0
windowsize -viewable ${nXpos}x${Display.Width}
}
I will be putting up a script at some point today or this weekend that will calculate "correct" size though, as with this script you will notice some distortion in the smaller windows
Connect With Us