hi,
is there a way to set the current movie with/from a variable in a script?
I want to script-import a lot of pictures from disk as an extra to the corresponding movies in the catalog. The picture name format is "movienumber_picnumber.jpg" (e.g. 635_1.jpg).
how can I add this example picture as an extra to movie with number 635?
Func ImportExtraPicture() imports to current movie, which is always first movie.
What I need is either set the current movie to "movienumber" or a function to import to a specific movienumber.
thanks
J.
set current movie in script
[solved]
OK,
made two solutions just in case someone might have usage for this too.
All pictures are in one directory with naming convention text_movienumber_picturenumber.jpg (e.g. Filme_635_1.jpg)
1: New function "SetActualMovie(movienumber);" to set current movie needed:
2: Nothing needed, just works
have fun.
EDIT:
Fixed a little sorting thing.
made two solutions just in case someone might have usage for this too.
All pictures are in one directory with naming convention text_movienumber_picturenumber.jpg (e.g. Filme_635_1.jpg)
1: New function "SetActualMovie(movienumber);" to set current movie needed:
Code: Select all
program picture_helper;
uses
StringUtils1;
var
DirList: TStringList;
counter, index: integer;
picture, movienumber: string;
begin
DirList := TStringList.Create;
DirList.Text := ListDirectory('D:\MPtest\', '*.*');
for counter := 2 to DirList.Count - 1 do
begin
picture := TextBefore(DirList.GetString(counter), #09, '');
movienumber := TextBetween(picture, '_', '_');
SetActualMovie(movienumber); // needed function !
index := AddExtra;
ImportExtraPicture(index, 'd:\mptest\' + picture);
SetExtraField(index, eCategory, 'Stills');
end;
DirList.Free;
end.
Code: Select all
program picture_helper_2;
uses
StringUtils1;
var
DirList: TStringListEx;
index: integer;
picture, movienumber: string;
begin
if GetIteration = 0 then
begin
DirList := TStringListEx.Create;
DirList.Text := ListDirectory('D:\MP\', '*.*');
DirList.Delete(0);
DirList.Delete(0);
DirList.NaturalSort;
end;
movienumber := TextBetween(DirList.GetString(0), '_', '_');
while GetField(fNumber) = movienumber do
begin
picture := TextBefore(DirList.GetString(0), #09, '');
index := AddExtra;
ImportExtraPicture(index, 'D:\MP\' + picture);
SetExtraField(index, eCategory, 'Stills');
DirList.Delete(0);
movienumber := TextBetween(DirList.GetString(0), '_', '_');
end;
if GetIteration = GetIterationCount-1 then DirList.Free;
end.
EDIT:
Fixed a little sorting thing.
-
- Posts: 764
- Joined: 2007-04-28 05:46:43
- Location: Italy