uses DPSCAD_TLB;
var
ListOfUnknown : IPCsList;
AllLists : IPCsLists;
i : integer;
EmptyStr : string;
begin
{check if we're connected to Automation}
if CheckConnection() then // (See function here)
begin
{minimize code by getting all lists into variable}
AllLists := PCsApplication.ActiveDocument.Drawing.Lists;
Randomize;
i := random(4);
{create random list}
case i of
0 : ListOfUnknown := AllLists.CreateCableList(EmptyStr);
1 : ListOfUnknown := AllLists.CreateTerminalList(EmptyStr);
2 : ListOfUnknown := AllLists.CreatePartList(EmptyStr); // Not implemented yet!
3 : ListOfUnknown := AllLists.CreateComponentList(EmptyStr);
end;
{find out what type of list, that was created}
case ListOfUnknown.ListType of
ltCable : ShowMessage('List is ltCable');
ltTerm : ShowMessage('List is ltTerm');
ltPart : ShowMessage('List is ltPart');
ltComp : ShowMessage('List is ltComp');
end;
end;
end;
var
ListOfUnknown : IPCsList;
AllLists : IPCsLists;
i : integer;
EmptyStr : string;
begin
{check if we're connected to Automation}
if CheckConnection() then // (See function here)
begin
{minimize code by getting all lists into variable}
AllLists := PCsApplication.ActiveDocument.Drawing.Lists;
Randomize;
i := random(4);
{create random list}
case i of
0 : ListOfUnknown := AllLists.CreateCableList(EmptyStr);
1 : ListOfUnknown := AllLists.CreateTerminalList(EmptyStr);
2 : ListOfUnknown := AllLists.CreatePartList(EmptyStr); // Not implemented yet!
3 : ListOfUnknown := AllLists.CreateComponentList(EmptyStr);
end;
{find out what type of list, that was created}
case ListOfUnknown.ListType of
ltCable : ShowMessage('List is ltCable');
ltTerm : ShowMessage('List is ltTerm');
ltPart : ShowMessage('List is ltPart');
ltComp : ShowMessage('List is ltComp');
end;
end;
end;
