Swap the names of two files

Heard you liked Rename Presets.

Swap Names.orp (822 Bytes)

var tab = DOpus.listers.lastactive.activetab;
var i = 0;
var k = tab.selected.count;

function OnGetCustomFields(getFieldData) {
    getFieldData.fields.swapExtension = true;
    getFieldData.field_labels('swapExtension') = 'Swap extension';
}

function OnGetNewName(getNewNameData) {
    var swapExtension = getNewNameData.custom.swapExtension;
    var j = (i % 2) == 0 ? i + 1 : i - 1;
    var tmp = j < k ? tab.selected(j).name_stem + tab.selected(swapExtension ? j : i).ext : false;
    i++;
    return tmp;
}

How to use Rename Presets from this forum

2 Likes