FindReplace

If you need help on how to use the program
zuzu
Posts: 4
Joined: 2006-03-11 08:23:10

FindReplace

Post by zuzu »

I just installed AMC 3.5.0.2 and can't find the the script FindReplace. I'm not sure if that is the corect name of script. Before that I used AMC 3.5.0.1 and the script was there. Maybe from a previous version, I don't remember, but is a very useful script for me.

Can you tell me where to find the script? Thx.
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

It may have been deleted... strange :??: I did not remember having deleted it, especially since version 3.5.0.1 (maybe it was when switching to version 3.5 from an older version)..

It is quite easy to make actually:

Code: Select all

program FindReplace;

const
  WholeWord = False;
  Search = 'old';
  Replace = 'new';
  Field = fieldOriginalTitle;

var
  s: string;
begin
  s := GetField(Field);
  if WholeWord then
  begin
    if s = Search then
      SetField(Field, Replace);
  end
  else
    SetField(Field, StringReplace(s, Search, Replace));
end.
zuzu
Posts: 4
Joined: 2006-03-11 08:23:10

Post by zuzu »

It's working, thank you for your fast reply.
LucMa
Posts: 36
Joined: 2005-04-02 16:16:08

Post by LucMa »

sorry can u post the complete script?

I have use the code that u have post but don't work

Can u tell me exacltly what i must do for use it?

I click ShiftF6 and i click on the new script but don't work for me

Bye:)
zuzu
Posts: 4
Joined: 2006-03-11 08:23:10

Post by zuzu »

Here is a simplified version of the script. The example is for changing the values in the field "Date Added". Be aware of date format, which must be the same used by Windows.

You can change the value of the Field with any other name available. See the AMC help for details. For me is working very well.

Code: Select all

program myReplace; 

const 
  WholeWord = False; 
  Field = fieldDate;
  Replace = '2006-03-26';

var 
  s: string; 
begin 
      SetField(Field, Replace); 
end.
zuzu
Posts: 4
Joined: 2006-03-11 08:23:10

Post by zuzu »

... abd what error message do you receive?
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

LucMa wrote: I click ShiftF6 and i click on the new script but don't work for me
As asked Zuzu, what error do you receive?
Using Shift+F6->new->paste is the good way to use it.
LucMa
Posts: 36
Joined: 2005-04-02 16:16:08

Post by LucMa »

I don't receive msg of error but i don't see/find the list of the duplicate. I have search in C: but nothing.

I have repeat the operation, i have click Using Shift+F6 - click on Editor tab, delete the line:

program NewScript;
begin
end.

and past the code of zuzu.
After i have save the script and i have click on F9 for execute the script but i don't see nothing..don't know :mad:
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

What list of duplicates ? :??: that script is to do a find/replace on field contents...
LucMa
Posts: 36
Joined: 2005-04-02 16:16:08

Post by LucMa »

ops sorry :mad:

i have read "replace" and i have associated it to duplicate..my english is terrible :ha: :(

can u tell me what i must do for find the duplicate movie?

Thank's :)
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

There is a "Find Duplicates" script provided with the program.
There is nothing special to do to use it, except that you have to be sure that you either selected all movies, or that you specify that the script has to be applied to all movies.
LucMa
Posts: 36
Joined: 2005-04-02 16:16:08

Post by LucMa »

sorry but i haven't find the script in the program. Can u tell me exactly what i must do for start it? I have selected all my movie and now?

Bye:)
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Shift+F6 (or Tools->Scripting), then select the "Find Duplicates" script.
LucMa
Posts: 36
Joined: 2005-04-02 16:16:08

Post by LucMa »

ok, many thank's :)
fulvio53s03
Posts: 745
Joined: 2007-04-28 05:46:43
Location: Italy

Post by fulvio53s03 »

I read this very interesting thread and I have a question about duplicate movies: how is it possible to add some other information to the output (i.e. the number of the movie, the date added etc) ?
Please, I'm not an expert, give me an example with the exact code.
thanks. :grinking:
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Find the lines looking like this:

Code: Select all

  case GetOption('TitleToUse') of
    1:  CurTitle := GetField(fieldOriginalTitle);
    2:  CurTitle := GetField(fieldTranslatedTitle);
    3:  CurTitle := GetField(fieldOriginalTitle) + ' | ' + GetField(fieldTranslatedTitle);
  else
For the option that you use (1, 2 or 3) modify the line to have all info that you which, e.g.:

Code: Select all

    1:  CurTitle := GetField(fieldNumber) + ' ' + GetField(fieldOriginalTitle) + ' ' + GetField(fieldDate);
The names of the fields (field-something) are described in the help file (tech info -> scripts)
fulvio53s03
Posts: 745
Joined: 2007-04-28 05:46:43
Location: Italy

Post by fulvio53s03 »

Thanks, It's clear! :hihi:
zxao
Posts: 8
Joined: 2007-05-05 08:53:44

Post by zxao »

Would i be able to use this to change the drive letter/location in the url field? I used to have a bunch of movies on my "e" drive but its now my "d" drive.
It would take me forever to go through and change the url for so many files.
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

zxao wrote:Would i be able to use this to change the drive letter/location in the url field? I used to have a bunch of movies on my "e" drive but its now my "d" drive.
Yes, you can use the script "FindReplace" from the posting above. Just replace the

Code: Select all

  Search = 'old';
  Replace = 'new';
  Field = fieldOriginalTitle;
with

Code: Select all

  Search = 'E:\';
  Replace = 'D:\';
  Field = fieldURL;
The drive letters are case sensitive, so take care if you have small or capital letters on your list (E:\ or e:\).

@antp: Maybe the FindReplace script (perhaps with some helpful comments) should be uploaded to update or archive server, too ?
zxao
Posts: 8
Joined: 2007-05-05 08:53:44

Post by zxao »

HEY! that makes sense. Thanks man! i actually just did a replace with the xml in notepad. (which i'm feeling very proud of at the moment) but thank you so much man I will be using your method from now on!
Post Reply