Dynamic folders with copying script

Post Reply
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Dynamic folders with copying script

Post by Eugene »

This example demonstrates the ability to create dynamic folders and copying script to properties of child folders for creating further levels of navigation.

The folder Collections - right click - Add folder
Title: Realtime folders
Type: Dynamic (script)
click Script

Expression

Code: Select all

const
  mpiFolderType         = 200;  
  mpiDynamicScript      = 500;
  mpiDynamicSyntaxType  = 501;  

function ItemLevel(aItem: TWmsScriptMediaItem): Integer;
begin
  Result := -1;
  while aItem <> nil do begin
    aItem := aItem.ItemParent;
    Inc(Result)
  end    
end;

var
  ChildFolder: TWmsScriptMediaItem;  
  i: Integer;
begin
//  WmsLogMessage(mtiInfo, FolderItem.Properties[mpiTitle]);
  if ItemLevel(FolderItem) < 10 then begin
    for i := 1 to 5 do begin
      ChildFolder := FolderItem.AddFolder(FolderItem.Properties[mpiTitle] + '_' + IntToStr(i));
      if ChildFolder <> nil then begin    
        ChildFolder.Properties[mpiFolderType] := FolderItem.Properties[mpiFolderType];        
        ChildFolder.Properties[mpiDynamicScript] := FolderItem.Properties[mpiDynamicScript];
        ChildFolder.Properties[mpiDynamicSyntaxType] := FolderItem.Properties[mpiDynamicSyntaxType];        
      end
    end    
  end else  
    for i := 1 to 5 do         
      WmsCreateMediaItem(FolderItem.Properties[mpiTitle] + '_Item_' + IntToStr(i), FolderItem.ItemID);
end.
Ok - Ok
realtime_folders.jpg
realtime_folders.jpg (134.71 KiB) Viewed 19923 times
Post Reply