Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   Data Output
 

Tutorials / Hta Tutorials / Data Output

<P><FONT face="Courier New">&lt;HTML&gt;<BR>&lt;HEAD&gt;<BR>&lt;TITLE&gt;HTA&lt;/TITLE&gt;<BR>&lt;HTA:Application<BR>ApplicationName = Processes<BR>BorderStyle = Raised<BR>ShowInTaskBar = No<BR>MaximizeButton = Yes<BR>MinimizeButton = Yes<BR>WindowState = Normal<BR>&gt; <BR>&lt;/HEAD&gt;<BR>&lt;SCRIPT language="VBScript"&gt;<BR>Sub Click_Me<BR>On Error Resume Next<BR>strHTML = "&lt;table border=1 cellpadding=2 width=50%&gt;"<BR>strHTML = strHTML &amp; "&lt;TR&gt;"<BR>strHTML = strHTML &amp; "&lt;TD&gt;&lt;B&gt;&lt;CENTER&gt;Service&lt;/CENTER&gt;&lt;/B&gt;&lt;/TD&gt;"<BR>strHTML = strHTML &amp; "&lt;TD&gt;&lt;B&gt;&lt;CENTER&gt;Status&lt;/CENTER&gt;&lt;/B&gt;&lt;/TD&gt;"<BR>strHTML = strHTML &amp; "&lt;/TR&gt;"</FONT></P>
<P><BR><FONT face="Courier New">strComputer = "."<BR>Set objWMIService = GetObject("winmgmts:\" &amp; strComputer &amp; "\root\CIMV2")<BR>Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Service", "WQL", _<BR>wbemFlagReturnImmediately + wbemFlagForwardOnly)<BR>For Each objItem In colItems<BR>If objItem.State = "Running" Then<BR>strHTML = strHTML &amp; "&lt;TR&gt;"<BR>strHTML = strHTML &amp; "&lt;TD&gt;" &amp; objItem.DisplayName &amp; "&lt;/TD&gt;"<BR>strHTML = strHTML &amp; "&lt;TD&gt;" &amp; objItem.State &amp; "&lt;/TD&gt;"<BR>End If<BR>Next<BR>strHTML = strHTML &amp; "&lt;/table&gt;"<BR>Output.InnerHTML = strHTML<BR>End Sub<BR>&lt;/SCRIPT&gt;<BR>&lt;BODY&gt;<BR>&lt;input id="runbutton" type="button" value="Click Me" name="run_button" onClick="Click_Me"&gt;<BR>&lt;span id="Output"&gt;&lt;/span&gt;<BR>&lt;/BODY&gt;<BR>&lt;/HTML&gt;<BR></FONT></P>



Please note that a disclaimer applies to any code on this page.
 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
- Script Editors
- Tutorials
     - Hta Tutorials
          - Data Output
          - Hta Basics
     - Vbscript Tutorials
     - Windows Unattended
- Vbscript