I took a look at your script and I isolated the code that seems to be problematic.
Code: Select all
program test;
var
i: integer;
sExt, sTrack, sTitle, sComposer, sTime: string;
fDur: extended;
begin
for i := 1 to on_getGrdRowCount do begin
on_setGrdRow( i );
on_LoadFile;
gTag.RemoveFromFile( 0 );
on_LoadFile;
gTag.ExtraFieldSet( 'CATALOG' , '1' );
gTag.ExtraFieldSet( 'COUNTRY' , '2' );
gTag.ExtraFieldSet( 'FORMAT' , '3' );
gTag.ExtraFieldSet( 'PUBLISHER', '4' );
on_UpdateThis( false ); // <-update row
on_getTrack( i, sTrack, sTitle, sComposer, sTime, fDur );
sExt := gTag.FileExt;
sTrack := PadLeft( Trim( sTrack ), 2, '0' )
on_setGrdField( 'Rename', sTrack + '. ' + sys_RemoveIllegalChars(sTitle) + '.' + sExt);
on_RenameThis; // <-rename row
end;
end.
This is what I used and it works ok, it removes the tag from the file, reloads adds users fields to it then updates using current grid/album info values just like the "Update This" pop menu command, this way each file is updated and renamed inside the for loop.
I have sen that you used On_apply,on_rename,on_update at a later stage please dont use those just rely on the above example to update/rename the files per row.
I did not have any problems with the VBR header , the only problem is that if you remove the tag replay gain info will be lost.