Programmation questions

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

Usually the BatchMode option '2' does similar, as the IMDB id is part of the URL. Still this won't work if you use URL field for local storage path or something.

You could replace

Code: Select all

MovieName := GetField(fieldURL);
with

Code: Select all

MovieName := 'http://www.imdb.com/title/' + GetCustomField('YourCustomFieldTag') + '/';
to make the script build the IMDB URL from the IMDB ID instead of reading the URL from URL field, just change YourCustomFieldTag to what you named your customfield and set BatchMode option to '2' then. This isn't the most elegant solution, but it's easy to add whenever the script might be updated in future.
KoolPal
Posts: 20
Joined: 2012-07-29 08:18:29

Post by KoolPal »

Thanks bad4u,

I did as you suggested, but I am new to this and messed up somewhere and some title names became blank.

Will use batch mode 2 for now and learn more of scripting.

Your input would help me get there.

Thanks for a quick reply.
raulsara
Posts: 54
Joined: 2006-02-13 14:05:04

Programar scripts

Post by raulsara »

Hola, que compilador y manual necesito para programar scripts.

Hello, wich compiler and manual i need to program scripts.

Thanks
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

There is no compiler, the scripts are executed by AMC.
As manual, you can check tutorials for Pascal or Delphi, as the language is similar. Additional functions are detailed in the Help of AMC.
raulsara
Posts: 54
Joined: 2006-02-13 14:05:04

Post by raulsara »

OK, i will try to program some spanish scripts.

Thanks
raulsara
Posts: 54
Joined: 2006-02-13 14:05:04

Post by raulsara »

Please i need help.

How can i display the value of field for debug a program
Whit Showmessage i can show a fixed field f.e. 'hello' but i don't know how can i display the value of variable. f.e. the name of the movie MovieName.

Is very important for me because i can debug ando follow the program.

Thanks
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

:??: if the variable is named MovieName you can simply do ShowMessage(MovieName);
raulsara
Posts: 54
Joined: 2006-02-13 14:05:04

Post by raulsara »

:clapping:

Thanks, it was very easy but did not know how.
raulsara
Posts: 54
Joined: 2006-02-13 14:05:04

Post by raulsara »

Hello antp, to show the value of a string is correct ShowMessage but to show the value of an integer ¿?

Thanks
kgytopi
Posts: 51
Joined: 2007-11-02 22:13:31
Location: Hungary, Budapest

Post by kgytopi »

raulsara wrote:Hello antp, to show the value of a string is correct ShowMessage but to show the value of an integer ¿?

Thanks

Showmessage(IntToStr(value));
raulsara
Posts: 54
Joined: 2006-02-13 14:05:04

Post by raulsara »

Thanks again
diegopau
Posts: 2
Joined: 2013-09-14 23:37:49

Post by diegopau »

Hi!

I am trying to edit a script so that I can get the description and comments info from FilmAffinity and set it to some custom fields I have created. I created the two custom fields with tags sinopsis_es and critica_es, and the only 2 lines that I've modified in the script are:

SetCustomField(sinopsis_es, Item);
instead of:
SetField (fieldDescription, Item)

and

SetCustomField(critica_es, Comments);
instead of:
SetField(fieldComments, Comments);

I get the error: "Script error in "FILMAFFINITY": unknown identifier: SINOPSIS_ES at line 304

But I think i am using the right procedure params:

procedure SetCustomField(fieldTag: string; value: string);
Stores a value in the specified custom field of the current movie.

What am i doing wrong?

Thanks in advance!
Raoul_Volfoni
Posts: 863
Joined: 2006-08-31 23:58:18

Post by Raoul_Volfoni »

Hi,
diegopau wrote:What am i doing wrong?
The first parameter is a string. You forgot the quotes for the fieldTag = 'fieldTag'

Code: Select all

SetCustomField('sinopsis_es', Item); 
SetCustomField('critica_es', Comments);
diegopau
Posts: 2
Joined: 2013-09-14 23:37:49

Post by diegopau »

Raoul_Volfoni wrote:Hi,
diegopau wrote:What am i doing wrong?
The first parameter is a string. You forgot the quotes for the fieldTag = 'fieldTag'

Code: Select all

SetCustomField('sinopsis_es', Item); 
SetCustomField('critica_es', Comments);
I knew it has to be something small, thanks a lot!!
rana
Posts: 1
Joined: 2013-09-24 23:48:25

question about stopping error messages

Post by rana »

Hi everyone, first of all, thanks a lot for this wonderful software. I have been using it for ages and it's great.

Today I have been looking at the brilliant imdb script to fit my need; I would like a real batch mode that would ignore all the errors like read timeout, 404 page not found and such. So basically, I can leave it running overnight and not to wake up to find that it stopped with a message box after parsing 4 movies :(

All these errors are originated from GetPage() call; so basically I am looking for any kind of throw exception method.

Thanks again guys; I have already made some major improvement on the existing script that I am hoping to share with the community.
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

That rather depends on AMC itself than on the script.
There is nothing made in AMC to properly handle these in the scripts, I think.
soulsnake
Posts: 756
Joined: 2011-03-14 15:42:20
Location: France

Post by soulsnake »

Maybe I could add a function like RaiseConnectionErrors(raise: boolean) to raise or not connection errors from GetPage, PostPage, GetPicture, ...

Soulsnake.
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Indeed, it could be useful for batch-processing.
The only thing to check is that the function return then an empty content and not random things or the previous data (for example).
Making one more version of the functions would be a little too much I guess, there are already many.
MarcelloCuoghi
Posts: 1
Joined: 2015-01-16 10:22:13

Post by MarcelloCuoghi »

Hi,
How can I add a sound like the system "beep" on a script??
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

I don't think the script engine has a function for that
Post Reply