Login Register






[AutoIt] Process Manager (Updated 12-1-11) filter_list
Author
Message
RE: [AutoIt] Process Manager (WIP) #2
Wow nice! with listview! what were the bugs of the string to chr converter?

Edit:

Here i modified it a bit Smile

Code:
#include <Array.au3> #include <GuiListView.au3> #include <GuiMenu.au3> #include <Process.au3> #include <GUIConstants.au3> #NoTrayIcon Main() SetPriority() Func Main() GUIDelete() AutoItSetOption("ExpandVarStrings", 1) $Main = GUICreate("Process Manager", 200, 300, -1, -1) Global $ProcessList = GUICtrlCreateListView("", 0, 0, 200, 280) $FileMenu = GUICtrlCreateMenu("File") $FileNew = GUICtrlCreateMenuItem("New Process", $FileMenu) $Exit = GUICtrlCreateMenuItem("Exit", $FileMenu) $ContextMenu = GUICtrlCreateContextMenu($ProcessList) $ContextEndProcess = GUICtrlCreateMenuItem("End Process", $ContextMenu) $ContextSetPriority = GUICtrlCreateMenuItem("Set Priority", $ContextMenu) Global $Process = ProcessList() _ArrayDelete($Process, 0) _ArrayDelete($Process, 0) _ArrayDelete($Process, 0) _GUICtrlListView_SetItemCount($ProcessList, $Process[0][0]) _GUICtrlListView_InsertColumn($ProcessList, 0, "Process", 120, 2) _GUICtrlListView_InsertColumn($ProcessList, 1, "PID", 60, 2) _GUICtrlListView_AddArray($ProcessList, $Process) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $ContextEndProcess _GUICtrlListView_BeginUpdate($ProcessList) $sIndex = _GUICtrlListView_GetSelectionMark($ProcessList) $SelectedProcess = $Process[$sIndex][0] ProcessClose($SelectedProcess) _GUICtrlListView_EndUpdate($ProcessList) Main() Case $FileNew $file = InputBox("New Process", "Enter a Valid File/Process to Open. Include Extension.") If Not @error And FileExists($file) Then Run($file) Main() EndIf Case $ContextSetPriority SetPriority() Case $Exit Exit EndSwitch WEnd EndFunc ;==>Main Func SetPriority() AutoItSetOption("ExpandVarStrings", 1) Global $ProcessList, $Process $wTitle = GUICreate("Set Priority", 200, 200) $sIndex = _GUICtrlListView_GetSelectionMark($ProcessList) $PID = $Process[$sIndex][1] $PriorityInteger = _ProcessGetPriority($PID) If $PriorityInteger = -1 Then $CurrentP = "Failed to Detect" If $PriorityInteger = 0 Then $CurrentP = "Idle/Low" If $PriorityInteger = 1 Then $CurrentP = "Below Normal" If $PriorityInteger = 2 Then $CurrentP = "Normal" If $PriorityInteger = 3 Then $CurrentP = "Above Normal" If $PriorityInteger = 4 Then $CurrentP = "High" If $PriorityInteger = 5 Then $CurrentP = "Realtime" $PriorityLabel = GUICtrlCreateLabel("Current Priority: " & $CurrentP, 20, 10) $SetTo0 = GUICtrlCreateRadio("Idle/Low", 50, 30, 150) If $PriorityInteger = 0 Then GUICtrlSetState($SetTo0, $GUI_DISABLE) $SetTo1 = GUICtrlCreateRadio("Below Normal", 50, 50, 150) If $PriorityInteger = 1 Then GUICtrlSetState($SetTo1, $GUI_DISABLE) $SetTo2 = GUICtrlCreateRadio("Normal", 50, 70, 150) If $PriorityInteger = 2 Then GUICtrlSetState($SetTo2, $GUI_DISABLE) $SetTo3 = GUICtrlCreateRadio("Above Normal", 50, 90, 150) If $PriorityInteger = 3 Then GUICtrlSetState($SetTo3, $GUI_DISABLE) $SetTo4 = GUICtrlCreateRadio("High", 50, 110, 150) If $PriorityInteger = 4 Then GUICtrlSetState($SetTo4, $GUI_DISABLE) $SetTo5 = GUICtrlCreateRadio("Realtime", 50, 130, 150) If $PriorityInteger = 5 Then GUICtrlSetState($SetTo5, $GUI_DISABLE) $ApplyButton = GUICtrlCreateButton("Apply", 75, 160, 50, 30) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case -3 GUIDelete() Main() Case $ApplyButton If GUICtrlGetState($SetTo0) = $GUI_CHECKED Then ProcessSetPriority($PID, $PriorityInteger) GUIDelete() Main() EndSwitch WEnd EndFunc ;==>SetPriority
(This post was last modified: 11-28-2011, 04:13 AM by Skullmeat.)
Pierce the life fibers with your drill.

Reply





Messages In This Thread