home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 April / CHIP_CD_2005-04.iso / software / netv / NVinst.exe / $INSTDIR / Scripts / Scripter / HtmlReport.nvs < prev    next >
Encoding:
Text File  |  2005-02-22  |  3.3 KB  |  99 lines

  1. {
  2. HTML report script v1.0 for NetView by KillerR
  3. Saves current hostlist state to an HTML file
  4. Saving occurs after every list recheck
  5. By the way you can use this script with NetView's
  6. HTTP server listener script in pair
  7.  
  8. User defined constants:
  9. HTMLFILENAME  - report file path and name. If you want to use
  10.                 this script with HTTP script you should set this
  11.                 const like '\Scripts\HTTP\index.html' or any other
  12.                 filename and set reference to it in index.html
  13. }
  14. const HTMLFILENAME='\Scripts\HTTP\index.html';
  15.  
  16. var e,i1,i2:integer;
  17.     tabs:TStringList;
  18.  
  19. procedure goreport;
  20. var fn,ts,lst,ctime:string;
  21.     hst:tnvhost;
  22.     i,f,flg:integer;
  23.     dtm:TDateTime;
  24. begin
  25. hst:=tnvhost.create;
  26. fn:=nv_directory+HTMLFILENAME;
  27. f:=openfile(fn,11);
  28. dtm:=Now;
  29. tabs.clear;
  30. writefile(f,'<html><title>NetView hostlist</title><body>');
  31. writefile(f,'<p align=center>Accessible resources list generated by NetView on '+FormatDateTime(' YYYY-MM-DD HH:MM.SS',dtm)+'</p>');
  32. writefile(f,'<TABLE x:str align=center border=1 cellpadding=0 cellspacing=0 style=''border-collapse: collapse;table-layout:fixed''>');
  33.  
  34. writefile(f,'<TR bgcolor="#C0C0C0">');
  35. writefile(f,'<td width=150><b>Hostname</b></td>');
  36. writefile(f,'<td width=150><b>IP address</b></td>');
  37. writefile(f,'<td width=150><b>Connection</b></td>');
  38. writefile(f,'<td width=150><b>Workgroup</b></td>');
  39. writefile(f,'</TR>');
  40.  
  41. hst.nextid:=0;
  42. repeat
  43. hst.gethost(hst.nextid,0);
  44. if(hst.id<>0)then
  45. begin
  46. flg:=strtoint(hst.getmetavar('flags'));
  47. lst:=hst.getmetavar('wgrp');
  48. ctime:=hst.getmetavar('ctime');
  49. if(flg and $200)=0 then
  50. begin
  51. if(hst.getmetavar('ison')='on')then ts:='<TR bgcolor="#E8F0F5">' else ts:='<TR>';
  52. ts:=ts+'<td width=150><a href="file://'+hst.hname+'/" target="_blank">\\'+hst.hname+'</a></td>';
  53. ts:=ts+'<td width=150><a href="file://'+hst.hip+'/" target="_blank">\\'+hst.hip+'</a></td>';
  54. ts:=ts+'<td width=150>'+ctime+'</td>';
  55. ts:=ts+'<td width=150>'+lst+'</td>';
  56. ts:=ts+'</TR>';
  57. tabs.add(lst+hst.hname+chr(13)+ts);
  58. end;
  59.  
  60. if((flg and $400)<>0) or ((flg and $1000)<>0) then
  61. begin
  62. if(hst.getmetavar('ison')='on')then ts:='<TR bgcolor="#E8F0F5">' else ts:='<TR>';
  63. ts:=ts+'<td width=150><a href="ftp://'+hst.hname+'" target="_blank">ftp://'+hst.hname+'</a></td>';
  64. ts:=ts+'<td width=150><a href="ftp://'+hst.hip+'" target="_blank">ftp://'+hst.hip+'</a></td>';
  65. ts:=ts+'<td width=150>'+ctime+'</td>';
  66. ts:=ts+'<td width=150>'+lst+'</td>';
  67. ts:=ts+'</TR>';
  68. tabs.add(lst+hst.hname+chr(13)+ts);
  69. end;
  70. end;
  71. until hst.nextid=0;
  72. tabs.Sort;
  73. for i:=0 to tabs.count-1 do
  74. begin
  75. ts:=tabs.strings[i];
  76. delete(ts,1,pos(chr(13),ts));
  77. writefile(f,ts);
  78. end;
  79. writefile(f,'</TABLE>');
  80. writefile(f,'<p align=center><a href=avilist.html> List of .avi files of all network</a></p>');
  81. writefile(f,'<p align="center">Powered by NetView<br><img border="0" src="nvico.gif" width="64" height="64"><br><a href="http://www.killprog.com">http://www.killprog.com</a></p>');
  82. writefile(f,'</body> </html>');
  83. closefile(f);
  84. hst.free;
  85. end;
  86.  
  87. begin
  88. tabs:=TStringList.Create;
  89. goreport;
  90. repeat
  91. e:=waitevent(i1,i2);
  92. if(e=NMNP_ACTION)then
  93. begin
  94. if((i1 and NVACTION_LIST)<>0) and (((i1 and NVACTION_RECHECK)<>0)or((i1 and NVACTION_GETFROMFILE)<>0)or((i1 and NVACTION_GETFROMNET)<>0)) then goreport;
  95. end;
  96. until e=0;
  97. tabs.Free;
  98. end.
  99.