Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. {
  2. Export list of records
  3. }
  4. unit UserScript;
  5.  
  6.  
  7. var
  8. slExport: TStringList;
  9. list : IInterface;
  10.  
  11. function Initialize: integer;
  12. begin
  13. slExport := TStringList.Create;
  14. end;
  15.  
  16. function Process(e: IInterface): integer;
  17. begin
  18. if(GetEditValue(ElementByPath(e,'NAME - Base')) <> '')
  19. then begin
  20. slExport.Add(
  21. ''+ IntToHex(FormID(e), 8) + '||' +
  22. ''+ GetEditValue(ElementByPath(e,'NAME - Base'))+ '||'
  23. ''+ GetEditValue(ElementByPath(e,'DATA - Position/Rotation\Position\X'))+ '||'
  24. ''+ GetEditValue(ElementByPath(e,'DATA - Position/Rotation\Position\Y'))+ '||'
  25. ''+ GetEditValue(ElementByPath(e,'DATA - Position/Rotation\Position\Z'))+ '||'
  26. ''+ EditorID(e)+''
  27. );
  28. end
  29. end;
  30.  
  31. function Finalize: integer;
  32. var
  33. dlgSave: TSaveDialog;
  34. ExportFileName: string;
  35. begin
  36. if slExport.Count <> 0 then begin
  37. dlgSave := TSaveDialog.Create(nil);
  38. try
  39. dlgSave.Options := dlgSave.Options + [ofOverwritePrompt];
  40. dlgSave.Filter := 'Excel (*.csv)|*.csv';
  41. dlgSave.InitialDir := 'C:\Users\screa\Desktop\WeaponData';
  42. dlgSave.FileName := 'wrlds.csv';
  43. if dlgSave.Execute then begin
  44. ExportFileName := dlgSave.FileName;
  45. AddMessage('Saving ' + ExportFileName);
  46. slExport.SaveToFile(ExportFileName);
  47. end;
  48. finally
  49. dlgSave.Free;
  50. end;
  51. end;
  52. slExport.Free;
  53. end;
  54.  
  55.  
  56. end.
  57. AddMessage('Processing: ' + FullPath(e));
  58.  
  59. end;
  60.  
  61. function Finalize: integer;
  62. begin
  63. Result := 0;
  64. end;
  65.  
  66. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement