My Current Code is:
function OnClick(data){
var files = data.func.sourcetab.selected_files;
var cmd = data.func.command; cmd.ClearFiles();
var re = new RegExp("(.*) - ([0-9]*) - (.*)(\.mp3|\.flac)");
for(var i=0;i<files.count;i++){
// DOpus.Output("File: [" + files(i).name+"]");
var matches = String(files(i).name).match(re);
// if (!matches){ DOpus.Output(" skipped"); continue; }
var artist = matches[1];
var track = matches[2];
var title = matches[3];
var cmdli = 'SetAttr META="artist:'+artist+'" "track:'+track+'" "title:'+title+'" FILE="'+files(i).realpath+'"';
//DOpus.Output(" cmd: " + cmdli);
cmd.RunCommand(cmdli);
// cmd.RunCommand('Rename FROM="'+ files(i) +'" TO="' + title + '" IGNOREEXT');
}
for(var i=0;i<files.count;i++){
var matches = String(files(i).name).match(re);
var title = matches[3];
cmd.RunCommand('Rename FROM="'+ files(i) +'" TO="' + title + '" IGNOREEXT');
}
}
Here I have used 2 for loop, the 2nd for loop used for run this command cmd.RunCommand('Rename FROM="'+ files(i) +'" TO="' + title + '" IGNOREEXT'); Is there any way to run this command in my 1st for loop? If I can run this command in 1st for Loop then I don't need to write the 2nd for loop command.