Replace Text In List (Custom Field)

If you need help on how to use the program
Post Reply
TickTock
Posts: 3
Joined: 2017-12-24 18:26:46

Replace Text In List (Custom Field)

Post by TickTock »

I have a custom field that is a list of eight different items and I forgot to change the default value when importing lots of new films.
I'm trying to use a script to change the selected films to a different item in the list, but I have no idea how to do this.

I have tried the following:

Code: Select all

program CustomChange;
var
MovieName: string;
begin
    MovieName := ('Films: Newly Imported');
    SetCustomField ('WatchedUnwatched', MovieName);
end.
Along with everything else I can think of and nothing works. The above code runs, but does nothing. I can copy the default text from the list to a different custom field, but not replace the text in the list. The only information in the help file relating to lists is 'ftList', but I have no idea how to use this to do what I need.

I'm hoping someone can provide some help please.
antp
Site Admin
Posts: 9675
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Replace Text In List (Custom Field)

Post by antp »

The syntax is SetCustomField(tagname, newvalue)
So if WatchedUnwatched is the tag of the custom field that you want to change, that line is correct. If the field has a different tag, that may be the reason why it does not work.
For the other line, MovieName := ('Films: Newly Imported'), the parenthesis are not useful here. It is correct if you want to put the text "Films: Newly Imported" in your custom field.
TickTock
Posts: 3
Joined: 2017-12-24 18:26:46

Re: Replace Text In List (Custom Field)

Post by TickTock »

Thanks for your response.

The tag name is correct. I created another custom field with the same list and settings, and the above code works :??:

As a test, I then changed the tag of the problematic custom field, ran the code and that didn't work. I even changed the tag to match the newly created custom field (after renaming it) and that also didn't work.

Could a setting cause the value not to be changed with custom lists?

Edit:

I exported my custom fields and opened the file with Notepad++, the custom field I'm having problems with has:

Code: Select all

ExcludedInScripts="True"
I removed that, saved the file and imported it back into Ant Movie Catalog and the script ran fine. I then found that setting can be changed
when opening the scripting window in the "Modifiable fields" section. I had unchecked it years ago :lol:
antp
Site Admin
Posts: 9675
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Replace Text In List (Custom Field)

Post by antp »

:) I didn't think about that, but it is good that you could solve it then.
Post Reply