Yeh I figured it can be better than what I came up. I often can't get the script to do what I want so find another approach. I think I got an error trying it your way, and that's why I tried a different route. I see know how that works, thanks a lot.
As you can gather I'm taking bits and bobs and piecing them together.
I always forget the undo part when doing proof of concept scripts.
So my next attempt - wondering if this is better or just stick to what you've done - as I do try - I often don't take all issues into account - what do you think @m1b
I'll save the wrapundo function separately as a must add for all scripts - it's so handy.
function setMinRowHeightNested() {
// Set measurement unit to points for consistency
app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
var minHeight = 10;
var doc = app.activeDocument;
// Loop through each story in the document
for (var s = 0; s < doc.stories.length; s++) {
var story = doc.stories[s];
// Loop through each table in the current story
for (var t = 0; t < story.tables.length; t++) {
var table = story.tables[t];
// Loop through each row in the table
for (var r = 0; r < table.rows.length; r++) {
var row = table.rows[r];
row.autoGrow = true;
row.minimumHeight = minHeight;
}
}
}
}
// Wrap the whole script in a doScript call for undo support
app.doScript(setMinRowHeightNested, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Set Min Row Height Nested");