Jump to content
Sign in to follow this  
Duran

Process viewer/killer

Recommended Posts

I was playing around with the processlist function and made a mini Task manager o.O But there is one thing i cant get to work or cant figure out how to do it is to close the selected file with the kill button. Here is the script so far.

#include <GUIConstants.au3>
#region; GUI Test Box
GUICreate("Test Box", 175, 300)

$Refresh = GUICtrlCreateButton("Refresh", 5, 265, 55)
$Kill = GUICtrlCreateButton("Kill", 65, 265, 45)
$Clear = GUICtrlCreateButton("Clear", 115, 265, 55)
$list = GUICtrlCreateList ("", 0,0,175,260)
GUICtrlSetLimit(-1,200)
GUISetState()
#endregion

#region; Varibles
$process = ProcessList()

#endregion

While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    
    Select
        
    Case $msg = $Refresh
        For $i = 1 to $process[0][0]
            GUICtrlSetData($list,$process[$i][0] & $process[$i][1])
        Next
        
    Case $msg = $Clear
        GUICtrlSetData($list, "")
        
    Case $msg = $Kill
        ProcessClose($Kill)
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

In order to find out which process has been selected, you need to use GUICtrlRead, so

ProcessClose($Kill)

should be replaced by:

ProcessClose(GUICtrlRead($list))

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...