Page 1 of 1

request: script to replace items

Posted: Thu Oct 20, 2016 10:35 am
by Wurlitzer
Hi,

is it possible to recplace items in a specific data field by script?
My problem: in several data fields, e.g. genre, I used "," as separator. Several music managing programs (e.g. Helium, Musicbee) use ";" as separator. What to do to replace "," with ";" in these data fields?

Re: request: script to replace items

Posted: Thu Oct 20, 2016 4:06 pm
by jtclipper
You could use a replacement matrix for that but here is a simple script that would do that.

Code: Select all

program replace_sep;

begin

  if not tg_Init then exit; // no rows get out

  repeat

    tg_setField( 'Genre', AnsiReplaceText( tg_getField( 'Genre' ), ',', ';' ) );
    tg_setField( 'Tones', AnsiReplaceText( tg_getField( 'Tones' ), ',', ';' ) );
    tg_setField( 'Styles', AnsiReplaceText( tg_getField( 'Styles' ), ',', ';' ) );
    tg_setField( 'Mood', AnsiReplaceText( tg_getField( 'Mood' ), ',', ';' ) );
    tg_setField( 'Situation', AnsiReplaceText( tg_getField( 'Situation' ), ',', ';' ) );

  until not tg_Skip;

end.
Moreover you can now easily modify the online amg script to use ; as a separator, At line 11

Code: Select all

const LIST_SEP = ','; 
you can change comma to a semicolon there

Re: request: script to replace items

Posted: Sat Oct 22, 2016 10:15 pm
by Wurlitzer
Thank you jtclipper,

this is amazing and will help me lot.