Page 1 of 1

Acces Violation when running script

Posted: Sat Aug 09, 2014 3:29 pm
by Goody
Bevor updating to the latest version of TGF 0.88 the script below worked like a charme.

The intention of the script is to set the "isCompilation" Flag for iTunes to true to have CD Samplers correctly viewed.

In 0.88 all i get is:

Code: Select all

Compiling...
Compiled succesfully
Exception: Access violation at address 0040888C in module 'TheGodFather.exe'. Read of address FFFFFFF7 at 0.301

Code: Select all

Program Make_iTunes_Compilation;

var
  i : integer;

begin

  if not tg_init then exit;

  i := 1;
  sys_SetStatusText( 2, IntToStr( tg_GetRowCount ) );

  repeat
    tg_loadFile;

    sys_SetStatusText( 1, IntToStr( i ) );
    sys_SetStatusText( 3, gTag.Filename );

    // showmessage(tg_GetField( 'Artist' ));

    gTag.Compilation := true;
    gTag.SaveToFile( 0, false);

    tg_RefreshRow;
    i := i + 1;
  until not tg_skip;

end.
What's wrong here?

Thanks!

Re: Acces Violation when running script

Posted: Sun Aug 10, 2014 11:58 am
by Goody
I've investigated this issue further. The violation is related to

Code: Select all

  gTag.Compilation := true;
What has been changed since the last TGF version? Is there a possible workaround to archive this setting in a script?

Re: Acces Violation when running script

Posted: Sun Aug 10, 2014 2:00 pm
by hopalongrock
I have a similar script, it clears the unneeded fields, including Compilation (set it to false), it works fine.

Re: Acces Violation when running script

Posted: Mon Aug 11, 2014 9:18 am
by Goody
Wow that's strange. If i change the Line from

Code: Select all

    gTag.Compilation := true;    
to

Code: Select all

    gTag.Compilation := false;    
und re-run it, i get also no exception....

Re: Acces Violation when running script

Posted: Mon Aug 11, 2014 1:02 pm
by jtclipper
The latest version introduced all the fields as variables and template entries, the field Compilation became a string type from Boolean and I forgot to update the help file.

You can use this :

Code: Select all

gTag.Compilation := '1';  // set compilation to true

gTag.Compilation := '';  // set compilation to false
Alternatively, you can now just use the template or the grid to manipulate this field just like any other basic field if you like.

Re: Acces Violation when running script

Posted: Mon Aug 11, 2014 1:10 pm
by hopalongrock
It's funny: gtag.compilation:=false works fine, but gtag.Compilation:='1' gives
Compiling...
Compiler: [Error] (75:22): Type mismatch
Compile failed

Re: Acces Violation when running script

Posted: Mon Aug 11, 2014 1:40 pm
by jtclipper
It seems that not only the help file was wrong the script engine needed a small update as well, I took care of that and it will be ready in the next beta

Re: Acces Violation when running script

Posted: Mon Aug 11, 2014 9:00 pm
by Goody
jtclipper wrote: Alternatively, you can now just use the template or the grid to manipulate this field just like any other basic field if you like.
That's great and i already saw this new feature :D. But the problem is that the script does a few more things, which i did not introduce here to keep the example pretty simple.

You already wrote that the String usage leads into a typ mismatch error while compiling....

I'am looking foreward to the next beta O0

Thanks for your great support and for TGF!

Re: Acces Violation when running script

Posted: Sat Aug 30, 2014 12:38 pm
by Goody
Fixed in beta 0.89

This code works now:

Code: Select all

    gTag.Compilation := '1';
Great! Thanks!