Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- List records from a group in the user's load order
- Created by matortheeternal
- }
- unit userscript;
- const
- // if save is true, a text file will be saved with the list
- // of records in the group
- save = true;
- // if print is true, the list of records will be printed directly
- // to xEdit's log
- print = true;
- // if masterOnly is true, override records will be ignored
- // (so only the base record gets listed)
- masterOnly = true;
- function Initialize: integer;
- var
- i, j: integer;
- f, g, e: IInterface;
- s: string;
- sl: TStringList;
- begin
- sl := TStringList.Create;
- s := InputBox('Group Signature',
- 'Enter the signature of the group of records you want to list',
- 'INGR');
- AddMessage('Listing '+s+' records...'#13#10);
- for i := 0 to FileCount - 1 do begin
- f := FileByIndex(i);
- g := GroupBySignature(f, s);
- if not Assigned(g) then continue;
- sl.Add(Format('%s [%d]', [GetFileName(f), ElementCount(g)]));
- for j := 0 to Pred(ElementCount(g)) do begin
- e := ElementByIndex(g, j);
- if not masterOnly then
- sl.Add(' '+Name(e))
- else if Equals(e, MasterOrSelf(e)) then
- sl.Add(' '+Name(e));
- end;
- sl.Add(' ');
- end;
- if print then AddMessage(sl.Text);
- if save then sl.SaveToFile('List of '+s+' records.txt');
- sl.Free;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment