Solo per campi stringa modificabili.
Per utilizzare su molti dati, consiglio un backup precedente.




Uniquement pour champs caractères et modifiables
Only string fields and modifiable.
Swaps or copy from first field to second field choosed.
Code: Select all
(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=Fulvio53s03 da scorpion7552
Title=SwapCopyFields
Description=inverse/copie 2 champs/ swaps/copy 2 fields
Site=
Language=EN,FR
Version=1.0
Requires=3.5.0
Comments=Uniquement des champs caractères et modifiables|Only string fields and modifiable. Swaps or copy from first field to second field choosed.
License=This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
GetInfo=0
RequiresMovies=1
[Options]
Mode=1|0|0=swap fields mode|1=copy fields mode)
[Parameters]
***************************************************)
program SwapFields;
var
CopyMode: Integer;
str1, str2, abort: string;
fld1, fld2: integer;
//------------------------------------------------------------------------------
// creates fields list and returns the selected field number
//------------------------------------------------------------------------------
function SelectField :integer;
var
fld: string;
begin
PickTreeClear;
if fld1 = 0 then
PickTreeAdd('Sélectionner le 1er champ/Select 1st field', '')
else
PickTreeAdd('Sélectionner le 2ème champ/Select 2nd field', '');
// create list (string fields only)
AddFieldToList(fieldMedia, 'Label/Etichetta');
AddFieldToList(fieldMediaType, 'Tipo');
AddFieldToList(fieldSource, 'Source/Origine');
AddFieldToList(fieldBorrower, 'Borrower');
AddFieldToList(fieldOriginalTitle, 'Titre original/Original Title');
AddFieldToList(fieldTranslatedTitle, 'Titre Traduit/Translated Title');
AddFieldToList(fieldDirector, 'Réalisateur/Director');
AddFieldToList(fieldProducer, 'Producteur/Producer');
AddFieldToList(fieldCountry, 'Pays/Country');
AddFieldToList(fieldCategory, 'Catégorie/Category');
AddFieldToList(fieldActors, 'Acteurs/Actors');
AddFieldToList(fieldUrl, 'Adresse Web/URL');
AddFieldToList(fieldDescription, 'Description');
AddFieldToList(fieldComments, 'Commentaires/Comments');
AddFieldToList(fieldMediaType, 'Media Type');
AddFieldToList(FieldFilePath, 'File Path');
AddFieldToList(FieldVideoFormat, 'Video Format');
AddFieldToList(FieldCertification, 'Certification');
AddFieldToList(FieldAudioFormat, 'Audio Format');
//
PickTreeExec(fld);
result := StrToInt(fld,0);
end;
//------------------------------------------------------------------------------
// add a field to the selection list
// AddFieldToList(fieldnumber, text_for_display);
//------------------------------------------------------------------------------
procedure AddFieldToList(fldn: integer; str:string);
begin
// if fieldnumber is not equal to fld1 (1st selected field) and is modifiable
if (fldn <> fld1) and CanSetField(fldn) then
PickTreeAdd(str, IntToStr(fldn));
end;
//------------------------------------------------------------------------------
// start here
//------------------------------------------------------------------------------
begin
if abort = 'o' then // selection has been canceled
exit;
if fld1 = 0 then // first time: select fields to swap
// note: number = 0 = fieldNumber: not selectable here
begin
if not CheckVersion(3,5,0) then
begin
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
abort := 'o';
exit;
end;
CopyMode := GetOption('Mode');
fld1 := SelectField;
if fld1 <> 0 then
begin
fld2 := SelectField;
end;
if CopyMode = 0 then ShowMessage('N.B. you are going to swap first field with the second');
if CopyMode = 1 then ShowMessage('N.B. you are going to copy first field to the second');
if (fld1 = 0) or (fld2 = 0) then
begin
abort := 'o'; // no selection
exit;
end;
end;
// swap/copy these two fields for the current item
str1 := GetField(fld1);
str2 := GetField(fld2);
SetField(fld2, str1);
if CopyMode = 0 then SetField(fld1, str2);
end.

Now it should be OK!
