[REL] Subroutine: The.Mission.[DVD] to The Mission

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
ABNormal
Posts: 135
Joined: 2005-01-08 08:33:38

[REL] Subroutine: The.Mission.[DVD] to The Mission

Post by ABNormal »

I'm trying to make a subroutine to put inside scripts that does this:

from a title like this:
Il.Colore.viola.[XviD-ITA-ENG].avi

changes dots into spaces and removes square brackets with all written inside, having a result like this:

Il Colore viola

Is anyone able to write the/a valid code?

Thank YOU all
ABN
Last edited by ABNormal on 2005-03-07 14:14:38, edited 2 times in total.
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

As I said somewhere else, simply use the functions of StringUtils1:

Code: Select all

program NewScript;

uses
  StringUtils1;

var
  s, s2: string;

begin
  s := StringReplace(GetField(fieldOriginalTitle), '.', ' ');
  s2 := TextBefore(s, '[', '');
  if s2 = '' then
    s2 := s;
  SetField(fieldOriginalTitle, s);
end.
ScorEpioN
Posts: 264
Joined: 2004-08-17 11:02:02

Post by ScorEpioN »

you could use my script "Update Fields" v10 or next v12
ABNormal
Posts: 135
Joined: 2005-01-08 08:33:38

Post by ABNormal »

now i have studied this script.

now i'm changing the MovieName definition (into scripts i use) as:

Code: Select all

    MovieName := StringReplace(GetField(fieldTranslatedTitle), '.', ' ');
    if MovieName = '' then
      MovieName := StringReplace(GetField(fieldOriginalTitle), '.', ' ');
While pos ('[', MovieName) > 0 Do begin
  MovieName := TextBefore(MovieName, '[', '') + TextAfter(MovieName, ']');
end;
(adding

Code: Select all

uses
  StringUtils1; 
at the beginning of each script, of course)

solving my little "problem"

i thank you for all your precious helps.
ABN
Post Reply