as doc is gone and no other commenters to old code found in:
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Board=UBB2&Number=127429&Main=127405#Post127429
built a new one, with minor change.
now it displays an image where tree can be expanded.
and, still now external stuff needed.
Code:
function buildHTMLtree($data)
dim $,$s,$bg,$section,$value
if 8<>vartype($data[0]) exit 1 endif
$buildHTMLtree='<span style="cursor:pointer;" id="s_' + $data[0] + '" onclick="var sauna = document.getElementById('
+"'"+$data[0]+"'"+"); var s2 = document.getElementById('s_"+$data[0]+"'); if (sauna.style.display == 'none')"
+" { sauna.style.display = 'block'; s2.innerHTML='<font face=Wingdings>1</font> <b>"+ $data[0]
+"</b>'; } else { sauna.style.display = 'none'; " +"s2.innerHTML='<font face=Wingdings>0</font> <b>"
+ $data[0] + "</b>';}" + '"><font face=Wingdings>0</font> <b>' + $data[0]
+ '</b></span><table id="' + $data[0] + '" style="display:none;"><tr><td width="20"> </td><td>'
for $section=1 to ubound($data)
if 0<ubound($data[$section])
if 8<>vartype($data[$section][1])
$buildHTMLtree=$buildHTMLtree+BuildHTMLtree($data[$section])
else
$buildHTMLtree=$buildHTMLtree+'<b>'+$data[$section][0]+'</b>'+
'<table><tr><td width="20"></td><td><table bgcolor="#EEEEEE">'
$bg=0
for $value=1 to ubound($data[$section])
$bg=$bg+1
$=split($data[$section][$value],chr(1))
$buildHTMLtree=$buildHTMLtree+'<tr '+iif($bg/2*2=$bg,'bgcolor="#FFFFFF"','')+'><td></td>'
for each $s in $ $buildHTMLtree=$buildHTMLtree+'<td>'+$s+'</td>' next
$buildHTMLtree=$buildHTMLtree+'</tr>'
next
$buildHTMLtree=$buildHTMLtree+'</table></td></tr></table>'
endif
endif
next
$buildHTMLtree=$buildHTMLtree+'</td></tr></table><br>'
endfunction
and here some example code to show how it works:
Code:
Function ListServices($Computer)
Dim $Service,$SL
For Each $Service In GetObject('winmgmts:{impersonationLevel=impersonate}!//' + $Computer + '\root\cimv2' ).ExecQuery('select * from Win32_Service', , 48)
$SL = $SL + chr(2) + $Service.Name + CHR(1) + $Service.DisplayName + CHR(1) + $Service.PathName + CHR(1) +
$Service.StartMode + CHR(1) + $Service.State + CHR(1) + $Service.StartName
Next
$ListServices=split($SL,chr(2))
EndFunction
Function ListProcess($Computer)
Dim $Process, $PL
For Each $Process In GetObject("winmgmts:{impersonationLevel=impersonate}!//" + $Computer ).ExecQuery("select * from Win32_Process")
If $Process.ExecutablePath = '' $Process.ExecutablePath = 'Path Unknown' EndIf
$PL = $PL + chr(2) + $Process.Name + CHR(1) + $Process.ProcessId + CHR(1) + $Process.ExecutablePath
Next
$ListProcess=split($PL,chr(1))
EndFunction
$HD="1","Model"+chr(1)+"IBM-DJSA-210","Interface"+chr(1)+"IDE","Size"+chr(1)+"10GB"
$HD2="2","Model"+chr(1)+"COM-CO10-JA0","Interface"+chr(1)+"SCSI","Size"+chr(1)+"9GB"
$OS="Operating System","Name"+chr(1)+"Windows 2000","Service Pack"+chr(1)+"4","Role"+chr(1)+"workstation","language"+chr(1)+"finnish"
$Antivir="Antivirus","Name"+chr(1)+"Fsecure AV","version"+chr(1)+"5.52","defTimeStamp"+chr(1)+"23.10.2004_03"
$services="Services",""
$services[1]=listServices(".")
$processes="Processes",""
$processes[1]=listServices(".")
$Hardware="Hardware",""
$Harddrives="Harddrives","",""
$Harddrives[1]=$hd
$Harddrives[2]=$hd2
$Hardware[1]=$harddrives
$software="Software","","","",""
$software[1]=$os
$software[2]=$antivir
$software[3]=$services
$software[4]=$processes
$header=@wksta,"",""
$header[1]=$hardware
$header[2]=$software
$ie = CreateObject("internetexplorer.application")
$ie.fullscreen = 1
$ie.menubar = 1
$ie.statusbar = 0
$ie.toolbar = 1
$ie.navigate("about:blank")
While $ie.busy AND $ie.readystate <> 4 AND @error = 0 Loop
$ie.document.write('<span style="position:absolute;right:10;cursor:pointer;" onclick="window.close()">Close</span>')
$ie.document.write(buildHTMLtree($header))
$ie.visible = 1