Answered
How to calculate the page layout, column width, and column spacing with scripting
I feel like the method I’m using now isn’t quite right.
Is the approach different for single-column layouts versus layouts with two or more columns?
Assuming the column widths are equal.
Also, how to know what is the number of columns?
var doc = app.activeDocument;
var item = doc.selection[0];
var items = doc.selection;
var pp = item.parentPage;
var cp = pp.marginPreferences.columnsPositions;
var csp,law,cw;
//Calculate column spacing
if (cp.length == 2) {
csp = 0;
}
else if (cp.length > 2) {
var csp = cp[2] - cp[1];
}
//typearea(?Layout)
var law=cp[cp.length-1]-cp[0]
//Column width
cw=cp[1]-cp[0]

