Acces Violation when running script

Use this forum for everything concerning script usage
Post Reply
Goody
Newbie
Newbie
Posts: 5
Joined: Sat Aug 09, 2014 3:24 pm

Acces Violation when running script

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

Goody
Newbie
Newbie
Posts: 5
Joined: Sat Aug 09, 2014 3:24 pm

Re: Acces Violation when running script

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

hopalongrock
Sr. Member
Sr. Member
Posts: 289
Joined: Wed Sep 15, 2010 1:38 pm

Re: Acces Violation when running script

Post by hopalongrock »

I have a similar script, it clears the unneeded fields, including Compilation (set it to false), it works fine.

Goody
Newbie
Newbie
Posts: 5
Joined: Sat Aug 09, 2014 3:24 pm

Re: Acces Violation when running script

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

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

Re: Acces Violation when running script

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

hopalongrock
Sr. Member
Sr. Member
Posts: 289
Joined: Wed Sep 15, 2010 1:38 pm

Re: Acces Violation when running script

Post by hopalongrock »

It's funny: gtag.compilation:=false works fine, but gtag.Compilation:='1' gives
Compiling...
Compiler: [Error] (75:22): Type mismatch
Compile failed

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

Re: Acces Violation when running script

Post 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

Goody
Newbie
Newbie
Posts: 5
Joined: Sat Aug 09, 2014 3:24 pm

Re: Acces Violation when running script

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

Goody
Newbie
Newbie
Posts: 5
Joined: Sat Aug 09, 2014 3:24 pm

Re: Acces Violation when running script

Post by Goody »

Fixed in beta 0.89

This code works now:

Code: Select all

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

Post Reply