Is there a way to create a shortcut to copy the file size in bytes?
Thank you.
Is there a way to create a shortcut to copy the file size in bytes?
Thank you.
This will put the byte size of each selected file into the clipboard, one file per line:
function OnClick(clickData) {
var cmd = clickData.func.command;
var tab = clickData.func.sourcetab;
cmd.deselect = false;
var tmp = '';
for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {
var item = e.item();
var sizeStr = item.size;
if (tmp != '')
tmp += '\r\n';
tmp += sizeStr;
}
if (tmp != '')
DOpus.SetClip(tmp);
}
Thank you for your reply.
I have one more question,
is there a way to copy the sum of the capacities of all selected files?
This should give you the totals:
function OnClick(clickData) {
var cmd = clickData.func.command;
var tab = clickData.func.sourcetab;
cmd.deselect = false;
var total = DOpus.FSUtil.NewFileSize(0);
for (var e = new Enumerator(tab.selected_files); !e.atEnd(); e.moveNext()) {
var item = e.item();
total.add(item.size);
}
DOpus.SetClip(total);
}
Thank you for your reply.