Page 1 of 1
Tg_GetRowCount
Posted: Sun May 01, 2016 10:17 pm
by markbolton
I am using this mainly to rename and tag audiobook files, in the format 'Book name - 01 of 32'. The obvious way to get the file count is to use the variable tg_GetRowCount, but I cannot work out how to do this. Are there any useful guides on scripting? Or can anyone help with this problem please?
Re: Tg_GetRowCount
Posted: Mon May 02, 2016 9:18 am
by jtclipper
Here is an example of a basic script that you can use:
Code: Select all
program ab_rename;
var
sTmp, sName: string;
i: integer;
begin
if not tg_Init then exit; // no rows get out
i := 1;
sName := InputBox( 'Type Name', 'Book name', 'Book name' );
repeat
sTmp := sName + ' - ' +
PadLeft( IntToStr( i ), 2, '0' ) + ' of ' +
PadLeft( IntToStr( tg_GetRowCount ), 2, '0' );
tg_setField( 'Rename', sTmp );
until not tg_Skip;
end.
It can be easily modified to your exact needs just let me know how it works for you
Re: Tg_GetRowCount
Posted: Fri May 06, 2016 2:16 pm
by markbolton
Thanks for your help with this JTClipper. I tweaked your code and got just what I needed. I did need to increment the counter though with:
i := i + 1;
The ease of this has opened up many more possibilities, and I will be experimenting over the next few days to make my tagging easier.
