• Ant Movie Catalog (4): Virtual fields and scripts

    Article by Ey@el

    The last part of this series of tutorial on AMC will provide a few tips on how to virtual fields and scripts.

    Virtual fields

    These are fields that are not displayed within the interface but which are used to group or sort movies in the left panel list. They may also be used in a HTML template (for displaying or exporting).

    Virtual fields can be added and managed exactly like custom fields. Just apply the same procedure as if you were adding a new custom field but in the TYPE field, select "Virtual" instead. The arrow at the right end of the TEMPLATE field will allow you to pick up the existing fields you wish to add to your virtual field. You can also add special characters and/or spaces as in the above capture.

    Now when you click on the Group button, you'll be able to select "Default group", and in the left panel your movies will be grouped per type and media (eg. TV Series > DVD). You may of course add more than two fields to a virtual field.

    Custom title

    Before Mickaël took over development of AMC, we only had a very limited single virtual field called "Formatted title" to display in the movie list and HTML export templates. Now you can also design a custom title in the same fashion as any other virtual field in which you can even add another virtual field you have created.

    To do so, you need to use the Tools - Preferences - Title formatting menu.


    You have scripts to retrieve informations about movies on the Internet and scripts to perform some batch operations on fields for a selection of movies or the whole catalog. I'll provide tips about the latter.

    To access scripting functions, you need to go to the Tools - Scripting menu.

    The first thing you should do every time you're about to run a script is to check which radio button is ticked in the Script limitations zone (on the right). Just imagine you have selected a couple of movies and the button All or Visible is checked. When you run the script, it will modify ALL movies instead of the selection you had made. In this case, you should have checked Selected. Visible is for search results whereas Checked needs no further explaination.

    You may use an existing script (if you have defined a folder to keep your scripts in located in the same folder as your catalog as advised in the first installment of this series of tutorials, then AMC should display them after you restart the program) and run it using the toolbar button or edit it by clicking on the Editor tab. You may create a new script by clicking on the Editor tab while no script is selected in the list.

    Below is a selection of scripts I found on AMC's forum which proved useful when I needed them. Since AMC started over a decade ago, you'll thank me for this time saving list. Do not feel daunted by using them. I don't know anything about scripting either still I managed to cope brilliantly with these. And last, but not least, backup your catalog before any important change since mishaps can happen so quickly!

    You may find the codes for the fields you wish to modify or direction to edit scripts in the help file.

    Rename a field

    The example below is to rename the exiting genre of a selction of movies as Comedy

    program NewScript;
    SetField(fieldCategory, 'Comedy');

    Rename a field according to its contents

    Here you can translate the contents of the Category field retrieved from the Internet into another language (ie French) :

    program NewScript;
    s: string;
    s := GetField(fieldCategory);
    if s = 'Comedy' then s := 'Comédie';
    if s = 'Detective' then s := 'Policier';
    if s = 'Fantasy' then s := 'Fantastique'; // etc...
    SetField(fieldCategory, s);

    Replace a field's contents with another's

    This script allows you to fill the Title (or Translated Title) field with the contents of the Original Title field.

    program NewScript;

    Capitalise titles (original and translated)

    program NewScript;
    SetField(FieldTranslatedTitle, AnsiLowercase(GetField(FieldTranslatedTitle)));
    SetField(fieldOriginalTitle, AnsiLowercase(GetField(fieldOriginalTitle)));
    SetField(FieldTranslatedTitle, AnsiUpFirstLetter(GetField(FieldTranslatedTitle)));
    SetField(fieldOriginalTitle, AnsiUpFirstLetter(GetField(fieldOriginalTitle)));

    Replace all dots in the Original Title field with spaces

    program NewScript;
    s: string;
    s := GetField(fieldOriginalTitle);
    s := StringReplace(s, '.', ' ');
    SetField(fieldOriginalTitle, s);

    Custom fields

    Any script can apply to custom fields as well but the coding will slightly differ. The Get or Set commands will need "Field" to be replaced with "CustomField" when using custom fields and the "FieldTag" will use only the "Tag" of custom fields. Here's a specific example:

    - Default field: SetField(FieldCategory, 'Comedy')
    - Custom field: SetCustomField('Category', 'Comedy')

    Here, I hope these few tips will be useful to you. Do not hesitate to ask for help on AMC's forum. Stay tuned for another series of tutorials and more HTML templates to download to manage and display other database of collectibles such as books or music with AMC.


    Related articles

    Reproduction of the above contents is strictly prohibited.
    © lapensinemutine.eklablog.com. All rights reserved.

    Back to top


    Bottom of page

    « Mind Control by Cell PhoneIndoctrination »

    Tags Tags: , , ,
  • Comments

    No comments yet

    Suivre le flux RSS des commentaires

    Add comment

    Name / User name:

    E-mail (optional):

    Website (optional):