Dear Bad4U,
I'm using your script (easier, clearer and better than mine) and I'm trying to go on with my project.
I'd like to create an .amc database where to insert manually the minimal necessary information so that: 
1) if in the fieldLabel I find the number of the Comic serie or the name of the comic serie I will not ask it
2) if in the fieldOriginalTitle i find the number of the comic, I don't ask it.
It looks easy to say but.... in writing the code my brain enters in a loop /tto much if, the, else, repeat, end etc.) and I don't succedd to write the right code:
Code: Select all
(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=
Title=sergiobonellieditore.it
Description=
Site=http://www.sergiobonellieditore.it/
Language=IT
Version=v.0.1.0
Requires=3.5.0
Comments=
License=
GetInfo=1
[Options]
***************************************************)
program sergiobonellieditore;
uses
  StringUtils1;   // Script needs external unit StringUtils1.pas in scripts folder !
var
  ComicURL, ComicSeries, ComicNumber, Collana: string;   // Define some script variables
  ctr, numCollana : integer;
  CollanaArray: Array of String;
  i, j: integer;
// ***** Analyze Item's Page *****
procedure AnalyzeItemPage(URL: String);   // Variable "URL" is handed over (former variable "ComicURL")
var
  Page, SavePage, Value: string;   // Define variables "Page" and "Value"
  ctr: integer;
begin
  Page := GetPage(URL);   // Fetch source code from website and store inside "Page"
  SavePage := Page;
// URL import
  Setfield(fieldURL, URL);   // Save variable URL to field URL
// Picture import
  Value := '';   // Make sure "Value" is empty
  Value := TextBetween(Page, 'window.open(''', '''');   // Extract the picture URL from "Page"
  if Value = '' then   // If "Value" is still empty ( = no picture URL ) then..
    Value := 'http://www.sergiobonellieditore.it' + TextBetween(Line, '<img src="', '"');   // .. try to extract URL for small picture instead
  if Value <> '' then   // If "Value" now contains picture URL then..
    GetPicture(Value);   // .. download and save picture
// Titolo tradotto
  Value := '';
  Value := TextBetween(Page, '<table border=0 cellspacing=0 cellpadding=0>', '</table>');   // Extract title part from variable "Page"
  Value := TextBetween(Value, '<b>', '</b>');   // Extract exact title from variable "Value" now
  Value := StringReplace(Value, ''', '''');  // sistema gli apostofi
  HTMLRemoveTags(Value);   // Clean title from HTML tags (if some exist)
  SetField(fieldTranslatedTitle, Value);   // Save title to field TranslatedTitle
// Beschreibung / Description / Storia
  Value := '';
// Storia
  Value := TextBetween(Page, '<table width=100% cellspacing=0 cellpadding=0 border=0>', ' </td>');   // Extract description part from variable "Page"
//  showmessage (Value)
  Value := TextBetween(Value, '<font face="Arial" size=2>', 'In questo numero:');   // Extract exact description from variable "Value" now
//  Value := TextBetween(Value, '<font face="Arial" size=2>', '</font>');   // Extract exact description from variable "Value" now
//  showmessage (Value)
  HTMLDecode(Value);   // Clean description from HTML codes (if some exist)
  HTMLRemoveTags(Value);
  Value := StringReplace(Value, ''', '''');  // sistema gli apostofi
  FullTrim(Value);   // Clean up the description
  SetField(fieldDescription, Value);   // Save description to field Description
  
// Comemnts / In questo numero
  Value := TextBetween(Page, '<table width=100% cellspacing=0 cellpadding=0 border=0>', ' </td>');   // Extract description part from variable "Page"
//  showmessage (Value)
  Value := TextBetween(Value, 'In questo numero:', '</font>');   // Extract exact description from variable "Value" now
//  showmessage (Value)
  HTMLDecode(Value);   // Clean description from HTML codes (if some exist)
  HTMLRemoveTags(Value);
  Value := StringReplace(Value, ''', '''');  // sistema gli apostofi
  FullTrim(Value);   // Clean up the description
  SetField(fieldComments, ('In questo numero: ' + Value));   // Save description to field Description
end; // End of procedure "AnalyzeItemPage"
// ***** Beginning of the script *****
begin
  SetarrayLength(CollanaArray, 71);   // 70 elementi(collane) + elemento 0
  j := High(CollanaArray) - low(CollanaArray);
//  showmessage ('elementi ***' + Inttostr(j) + '***');
  CollanaArray[00] := 'Collana mancante';
  CollanaArray[01] := 'Tex Willer';
  CollanaArray[02] := 'Almanacco del West';
  CollanaArray[04] := 'Julia';
  CollanaArray[07] := 'Brendon';
  CollanaArray[08] := 'Dampyr';
  CollanaArray[11] := 'Napoleone';
  CollanaArray[15] := 'Nathan Never';
  CollanaArray[18] := 'Dylan Dog';
  CollanaArray[25] := 'Almanacco dell''avventura';
  CollanaArray[34] := 'Almanacco della Fantascienza';
  CollanaArray[36] := 'Almanacco della Paura';
  CollanaArray[70] := 'Almanacco del Giallo';
  
  if CheckVersion(3,5,0) then // Checks if Ant Movie Catalog version is 3.5.0 or higher
     begin
     collana := getfield(fieldMedia);
     numCollana := strtoint(collana, 0);
     showmessage ('collana0 ***' + collana + '***')
     showmessage ('numcollana0 ***' + inttostr(numcollana) + '***')
     if numCollana = 0 then
        begin
        if length(collana) = 0 then
           begin
           input('www.sergiobonellieditore.it', 'Enter comic series:', ComicSeries); // Asks for comic series number only 1 time
           ctr := ctr + 1;
           showmessage ('collana1 ' + collana + '***');
           end
        else
           repeat
           collana :=  CollanaArray[i];
           numCollana := i;
           until i > j or (collana =  CollanaArray[i]);
           end;
     else
        begin
        ComicSeries := collana;
        showmessage ('collana2 ' + collana + '***')
        SetField(fieldMedia, CollanaArray[numCollana])
        end;
     end
//    Input('www.sergiobonellieditore.it', 'Enter comic number:', ComicNumber); // Asks for comic item number
      ComicNumber := getfield(fieldOriginalTitle);
      ComicURL := 'http://www.sergiobonellieditore.it/auto/alborist?collana=' + ComicSeries + '&numero=' + ComicNumber + '&subnum=0'; // Build item URL
      AnalyzeItemPage(ComicURL); // Script hands over item URL and jumps to procedure AnalyzeItemPage
     end
  else
    ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)'); // If Checkversion fails
end.
     
will you help me again to escape from my coding Error?
Thanks in advance. 
