Aha, so the error is on my side. Very good, I prefer that! o) I was kinda blinded by the colon, overlooking the more obvious space issue.
Indeed, the d-quotes made it work! I tweaked your button a little so it always uses quotes for the Set COLUMNADD command.
v0.1 - Leos initial post here: Tutorial video: Column resizing & folder formats
v0.2 - fixed to work with spaces in column names (affects script columns)
function OnClick(clickData){
var colParams = "";
for(var e = new Enumerator(clickData.func.sourcetab.format.columns); !e.atEnd(); e.moveNext()){
var col = e.item();
if (!col.Autosize || col.Max != 0){
if (colParams) colParams += ",";
colParams += col.Name;
colParams += "(!,a,0)"; // Keep position. Auto-size. No maximum.
}
}
var cmd = "Set FORMAT=!folder";
if (colParams) cmd = 'Set COLUMNSADD="'+colParams+'"';
clickData.func.command.RunCommand(cmd);
}
Thank you for the quick solution! o)