Tg_GetRowCount

Main discussion forum
Post Reply
markbolton
Newbie
Newbie
Posts: 3
Joined: Sun May 01, 2016 8:18 pm

Tg_GetRowCount

Post 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?

User avatar
jtclipper
Administrator
Administrator
Posts: 768
Joined: Tue Aug 10, 2010 12:04 pm

Re: Tg_GetRowCount

Post 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

markbolton
Newbie
Newbie
Posts: 3
Joined: Sun May 01, 2016 8:18 pm

Re: Tg_GetRowCount

Post 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. :)

Post Reply