Here it is (updated with tbone's improvements; see below):
Auto-Size All.dcf (1.44 KB)
Update:
- tbone has improved the script to work with column names that contain spaces, here. I overlooked that, since none of the internal column names use spaces, but it is needed for script columns (including some of my own ).
- It has also been changed to not deselect everything when you use it.
- Copying tbone's changes here to keep everything in one place:
JScript: (v0.3 - tbone's improvements)
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.deselect = false;
clickData.func.command.RunCommand(cmd);
}
Installing:
As shown in the video, this script can be added to the Column Header Context Menu, by updating the Lister Column Header in the Customize dialog.
Original version shown in the video
JScript (original version shown in the video):
function OnClick(clickData)
{
var anyColumns = false;
var cmdLine = "Set COLUMNSADD=";
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 (anyColumns) cmdLine += ",";
cmdLine += col.Name;
cmdLine += "(!,a,0)"; // Keep position. Auto-size. No maximum.
anyColumns = true;
}
}
if (!anyColumns) cmdLine = "Set FORMAT=!folder";
clickData.func.command.RunCommand(cmdLine);
}