Tag from filename or to filename

To leave behind the rename-script hacks, you maybe like this short snippet I posted some days ago for mykael.
It grabs the track number from the selected file and puts / into the mp3 metadata.
Adjusting this to work with "artist - track - title.mp3" or something, should be very easy and it should be noticeably faster as well.

[code]@script jscript

function OnClick(data){
var files = data.func.sourcetab.selected_files;
var cmd = data.func.command; cmd.ClearFiles();
var re = new RegExp("(.?) (.)(\.mp3)");
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 track = matches[1]; //var title = matches[2];
var cmdli = 'SetAttr META="track:'+track+'/'+files.count+'" FILE="'+files(i).realpath+'"';
DOpus.Output(" cmd: " + cmdli);
cmd.RunCommand(cmdli);
}
}[/code]