Jump to content

PLloyd

Member
  • Posts

    2
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

Everything posted by PLloyd

  1. Hey Thanks Iceman, that works great.
  2. Hello all, I'm attempting to create a simple hta that displays the system processes in an option box and then create a button on the same page that will eventually kill th process selected. I just cant the button to work and do anything. Could anyone give me some advice on how to do it. The following is what i have thus far: <html> <head> <title>HTA Test</title> <HTA:APPLICATION ID="objTest" APPLICATIONNAME="HTA Test" SCROLL="auto" SINGLEINSTANCE="yes" > </head> <script LANGUAGE="VBScript"> Option Explicit Dim dblQuotes, strHTML, strComputer, strOption,objWMIService, colProcesses, iTimerID, optionvalue, strSize, strName Dim strButton, strKillProcess, strKillProcTitle, strCloseOption, objProcess, colProcess dblQuotes = chr(34) strHTML = "" strComputer = "." strButton = "button" strKillProcess = "KillProcess" strKillProcTitle = "Kill Process" 'The following will get a list of the current running processes on the host machine and output them to the HTA window Sub RefreshList 'strOption = "<option value=" & dblQuotes & optionvalue & dblQuotes & ">" & objProcess.value & "</option>" Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process") 'For Each objProcess in colProcesses ' strHTML = strHTML & objProcess.Name & "<BR>" 'Next 'ProcessList.InnerHTML = strOption optionvalue = 0 strSize = dblQuotes & "3" & dblQuotes strName = dblQuotes & "MultiListbox" & dblQuotes document.write("<select size=" & strSize & " name=" & strName &" multiple>") For Each objProcess in colProcesses strOption = "<option value=" & dblQuotes & optionvalue & dblQuotes & ">" & objProcess.Name strCloseOption = "</option>" optionvalue = optionvalue + 1 document.write(strOption) document.write(strCloseOption) Next document.write("</select>") document.write("<input id=killbutton type=" & dblQuotes & strButton & dblQuotes &" value=" & dblQuotes & strKillProcTitle & dblQuotes & " name=" & dblQuotes & strKillProcess & dblQuotes & " onClick=" & dblQuotes & strKillProcess & dblQuotes) document.write(">") End Sub 'The following will cause the window to refresh itself at a set interval of miliseconds 'refreshList is a sub routine to be called and reloaded every 30000 miliseconds (30 sec) Sub Window_OnLoad 'RefreshList iTimerID = window.setInterval("RefreshList", 300) End Sub Sub KillProcess If optionvalue <> 0 Then Msgbox "You selected Option " & optionvalue & "." Else Msgbox "Nothing to display!" End If End Sub </SCRIPT> <body> </body> </html>
×
×
  • Create New...