Do You think it's possible to rename the movie File with the value of the field transalated (or orignal) title by the scripts method?
It would be useful and really easy for the ant renamer programmer..
Rename Files
Using scripts it is possible actually.
As long as the title does not contain forbidden characters.
If you do something like that:
(not tested)
But this will open one console window per movie (it will be closed once renamed), so if you plan to do it on many movies it is maybe better to write the "ren" commands in a text field (using a TStringList) with a ".bat" extension, that you can launch manually later.
As long as the title does not contain forbidden characters.
If you do something like that:
Code: Select all
program NewScript;
begin
Launch('cmd /c ren "' + GetField(fieldUrl) + '" "' + GetField(fieldTranslatedTitle) + '.avi"');
end.
But this will open one console window per movie (it will be closed once renamed), so if you plan to do it on many movies it is maybe better to write the "ren" commands in a text field (using a TStringList) with a ".bat" extension, that you can launch manually later.
Sorry, I forgot that parameter was separated:
Code: Select all
program NewScript;
begin
Launch('cmd', '/c ren "' + GetField(fieldUrl) + '" "' + GetField(fieldTranslatedTitle) + '.avi"');
end.
Yes. It's as you suggest.
I've already solved so:
Code:
program Rename;
Var
Temp, Perc :String;
BegPos : integer;
begin
Launch('CMD','/C rename "'+GetField(FieldUrl)+'" "'+GetField(FieldTranslatedTitle)+'.avi"') ;
Perc := GetField(FieldUrl); // rinomina l'URL
Temp := '';
Repeat
BegPos := Pos('\', Perc);
Temp := Temp + (Copy(Perc,1,BegPos));
Delete(Perc,1,BegPos)
Until Begpos = 0;
Temp := Temp + (Getfield(FieldTranslatedTitle))+'.avi';
SetField(FieldUrl,temp);
end.
I would like a more practical script (i.e.: a bat file for several movies as you suggest) for the forbidden characters too.
I'm tryng to write it (It's easy i suppose).
Thanks for your help.
Ciao
I've already solved so:
Code:
program Rename;
Var
Temp, Perc :String;
BegPos : integer;
begin
Launch('CMD','/C rename "'+GetField(FieldUrl)+'" "'+GetField(FieldTranslatedTitle)+'.avi"') ;
Perc := GetField(FieldUrl); // rinomina l'URL
Temp := '';
Repeat
BegPos := Pos('\', Perc);
Temp := Temp + (Copy(Perc,1,BegPos));
Delete(Perc,1,BegPos)
Until Begpos = 0;
Temp := Temp + (Getfield(FieldTranslatedTitle))+'.avi';
SetField(FieldUrl,temp);
end.
I would like a more practical script (i.e.: a bat file for several movies as you suggest) for the forbidden characters too.
I'm tryng to write it (It's easy i suppose).
Thanks for your help.
Ciao
For the batch file you can see how the "find duplicate" script reads/writes a TStringList.
To prevent forbidden characters, a for-loop on the string to check each character and replace it if needed should do the trick.
Something like that:
To prevent forbidden characters, a for-loop on the string to check each character and replace it if needed should do the trick.
Something like that:
Code: Select all
for i := 1 to Length(s) do
begin
if c := StrGet(s, i);
if (c <> '?') and (c <> '*') etc... then
s2 := s2 + c;
end;