Jump to content

Process Manager v2


Nahuel
 Share

Recommended Posts

I updated my crappy process manager to a way better version. Now with no jumping :)

You can:

  • End processes
  • Run processes
  • Control memory status
I made this because Windows 98 doesn't have a 'proper' one and this one did the job :)

#include <WindowsConstants.au3>
#Include <GuiListBox.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>

Opt("TrayAutoPause",0)
Opt("TrayIconHide",1)
Opt("TrayMenuMode",1)
Opt("GUICloseOnESC",0)

Global $about

$Main = GUICreate("Process Manager", 316, 370, 235, 109,-1,$WS_EX_TOPMOST )
$Tabs = GUICtrlCreateTab(8, 0, 297, 305)
$Procesos = GUICtrlCreateTabItem("Processes")
$ListadeProcesos = GUICtrlCreateList("", 21, 36, 273, 214)
$Terminar = GUICtrlCreateButton("&Terminate", 28, 265, 105, 25, $BS_DEFPUSHBUTTON)
$Ejecutar = GUICtrlCreateButton("&Run", 168, 264, 97, 25, 0)
$Rendimiento = GUICtrlCreateTabItem("Performance")
$Label1 = GUICtrlCreateLabel("RAM in use", 32, 48, 106, 17)
$Label2 = GUICtrlCreateLabel("Total RAM", 32, 72, 70, 17)
$Label3 = GUICtrlCreateLabel("RAM available", 32, 97, 78, 17)
$Label5 = GUICtrlCreateLabel("Total Pagefile", 32, 153, 65, 17)
$Label4 = GUICtrlCreateLabel("Available Pagefile", 32, 176, 92, 17)
$Label6 = GUICtrlCreateLabel("Total Virtual", 32, 232, 98, 17)
$Label7 = GUICtrlCreateLabel("Available Virtual", 32, 256, 125, 17)
GUICtrlCreateGroup("RAM Memory", 16, 24, 281, 97)
$RAMenUso = GUICtrlCreateInput("", 160, 40, 129, 21, BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
$TotalRAM = GUICtrlCreateInput("", 159, 67, 129, 21, BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
$RAMdisponible = GUICtrlCreateInput("", 159, 94, 129, 21, BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Pagefile", 16, 128, 281, 73)
$PageTotal = GUICtrlCreateInput("", 159, 146, 129, 21, BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
$PageDisponible = GUICtrlCreateInput("", 159, 173, 129, 21, BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Virtual Memory", 16, 208, 281, 73)
$VirtualTotal = GUICtrlCreateInput("", 160, 224, 129, 21,BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
$VirtualDisponible = GUICtrlCreateInput("", 160, 251, 129, 21,BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlCreateTabItem("")
$BotSalir = GUICtrlCreateButton("&Exit", 168, 320, 113, 25, 0)
$Apagar = GUICtrlCreateButton("&Shutdown", 32, 320, 105, 25, 0)
$Archivo = GUICtrlCreateMenu("&File")
$Refrescar = GUICtrlCreateMenuItem("Refresh now", $Archivo)
GUICtrlCreateMenuItem("", $Archivo)
$Salir = GUICtrlCreateMenuItem("Exit", $Archivo)
$Ayuda = GUICtrlCreateMenu("&Help")
$Acerca = GUICtrlCreateMenuItem("About", $Ayuda)
GUISetState(@SW_SHOW)

cargar_Info()

AdlibEnable("cargar_Info",2000)
While 1
    $tMsg=TrayGetMsg()
    $nMsg = GUIGetMsg()
    Select
        Case  $tMsg = $TRAY_EVENT_PRIMARYDOWN
            Opt("TrayIconHide",1)
            GUISetState(@SW_SHOW,$Main)  
        Case  $nMsg = $GUI_EVENT_CLOSE
            Exit
        Case  $nMsg = $GUI_EVENT_MINIMIZE
            Opt("TrayIconHide",0)
            GUISetState(@SW_HIDE,$Main)
        Case  $nMsg = $BotSalir
            Exit
        Case  $nMsg = $Salir
            Exit
        Case  $nMsg = $Terminar
            Dim $iMsgBoxAnswer1
            $iMsgBoxAnswer1 = MsgBox(4148,"Warning","Terminating '" &GUICtrlRead($ListadeProcesos)&"' may cause the loss " & @CRLF &"of important data that hasn't been saved" & @CRLF & "Continue?")
            Select
                Case $iMsgBoxAnswer1 = 6 ;Si
                    ProcessClose(GUICtrlRead($ListadeProcesos))
                    $KillWait=ProcessWaitClose(GUICtrlRead($ListadeProcesos),5)
                    If $KillWait=0 Then
                        MsgBox(4112,"Error","Could not terminate process")
                    EndIf
                    cargar_Info()
                Case $iMsgBoxAnswer1 = 7 ;No
            EndSelect
        Case  $nMsg = $Ejecutar
            ejecutar() 
        Case  $nMsg = $Apagar
        Dim $iMsgBoxAnswer
        $iMsgBoxAnswer = MsgBox(4388,"Shutdown","Shutdown PC?")
        Select
            Case $iMsgBoxAnswer = 6
                Shutdown(9)
            Case $iMsgBoxAnswer = 7
        EndSelect
    Case  $nMsg = $acerca
        about()
    Case  $nMsg = $Refrescar
        cargar_Info()
    EndSelect
WEnd

Func cargar_Info()
    ;Procesos
    $Procesos=ProcessList()
    $NumDePros=_GUICtrlListBox_GetCount($ListadeProcesos)
    If $Procesos[0][0]<>$NumDePros Then
        GUICtrlSetData($ListadeProcesos,"")
        $sHold = ""
        for $i = 1 to $Procesos[0][0]
            $sHold &= $Procesos[$i][0] & '|'
        next
        GUICtrlSetData($ListadeProcesos,$sHold)
    EndIf

    ;Memoria
    $Memoria=MemGetStats()

        GUICtrlSetData($RAMenUso,$Memoria[0]&"%")
       
        GUICtrlSetData($TotalRAM,$Memoria[1]&" KB")

        GUICtrlSetData($RAMdisponible,$Memoria[2]&" KB")

        GUICtrlSetData($PageTotal ,$Memoria[3]&" KB")

        GUICtrlSetData($PageDisponible ,$Memoria[4]&" KB")

        GUICtrlSetData($VirtualTotal ,$Memoria[5]&" KB")

        GUICtrlSetData($VirtualDisponible ,$Memoria[6]&" KB")

EndFunc




Func about()
Opt("GUIOnEventMode",1)
$about = GUICreate("About", 222, 220, 225, 137, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS),-1,$Main)
GUISetOnEvent ($GUI_EVENT_CLOSE, "AboutOK" )
GUICtrlCreateIcon(@AutoItExe, -1, 95, 88)
GUICtrlCreateLabel("Process Manager 2.0", 40, 10, 200, 17)
GUICtrlSetFont (-1,10, 800, 0, "Arial") ; bold
GUICtrlCreateLabel("Created by", 48, 32, 56, 17)
$email=GUICtrlCreateLabel("Nahuel José", 103, 32, 63, 17)
GuiCtrlSetFont($email, 8.5, -1, 4) ; underlined
GuiCtrlSetColor($email,0x0000ff)
GuiCtrlSetCursor($email,0)
GUICtrlSetOnEvent(-1, "OnEmail")
$Label4 = GUICtrlCreateLabel("Created with:", 80, 64, 62, 17)
 GUICtrlCreateLabel("AutoIt v3", 83, 128, 107, 17)
 GUICtrlSetFont (-1,10, 800, 0, "Arial") ; bold
$www = GUICtrlCreateLabel("www.autoitscript.com", 60, 152, 105, 17)
GuiCtrlSetFont($www, 8.5, -1, 4) ; underlined
GuiCtrlSetColor($www,0x0000ff)
GuiCtrlSetCursor($www,0)
GUICtrlSetOnEvent(-1, "OnWWW")
GUICtrlCreateButton("Aceptar", 72, 176, 81, 25, $BS_DEFPUSHBUTTON)
GUICtrlSetOnEvent(-1, "AboutOK")
GUISetState(@SW_SHOW, $about)



EndFunc

Func ejecutar()
GUICreate("Run external program", 291, 120, 226, 156, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS),-1,$Main)
GUICtrlCreateLabel("Type the name or path of the program", 8, 16, 276, 17)
$RutaEjecutar = GUICtrlCreateInput("", 8, 40, 273, 21)
$Correr = GUICtrlCreateButton("&Run", 8, 80, 73, 25, $BS_DEFPUSHBUTTON)
$Cancelar = GUICtrlCreateButton("&Cancel", 104, 80, 75, 25, 0)
$Examinar = GUICtrlCreateButton("&Browse", 200, 80, 75, 25, 0)
GUISetState()
While 1
    $CMsg=GUIGetMsg(1)
    Select
    Case $CMsg[0]=$GUI_EVENT_CLOSE OR $CMsg[0]=$Cancelar
        GUIDelete($CMsg[1])
        If $CMsg[1]=$Main Then Exit
        ExitLoop
    Case $CMsg[0]=$Correr
        Run(GUICtrlRead($RutaEjecutar))
        If @error=1 Then
            MsgBox(4112,"Error","Could not run external program")
        Else
            GUIDelete($CMsg[1])
            ExitLoop
        EndIf
    Case $CMsg[0]=$Examinar
        WinSetOnTop("Process Manager","",0)
        WinSetOnTop("Run external program","",0)
        $Ruta=FileOpenDialog("Search the program to run",@Programfilesdir,".exe Files (*.exe)", 1 )
        If not @error Then
            GUICtrlSetData($RutaEjecutar,$Ruta)
        EndIf
        WinSetOnTop("Process Manager","",1)
        WinSetOnTop("Run external program","",1)
    EndSelect
WEnd
       

EndFunc

Func OnEmail()
    Run(@ComSpec & " /c " & 'start mailto:nahueljose@gmail.com?subject=', "", @SW_HIDE)
EndFunc

Func OnWWW()
    Run(@ComSpec & " /c " & 'start www.autoitscript.com', "", @SW_HIDE)
EndFunc

Func AboutOK()
    Opt("GUIOnEventMode",0)
    GUIDelete($about)
EndFunc
Edited by Nahuel
Link to comment
Share on other sites

  • 1 month later...
  • 6 months later...

#include <WindowsConstants.au3>
#Include <GuiListBox.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <Constants.au3>

Opt("TrayAutoPause",0)
Opt("TrayIconHide",1)
Opt("TrayMenuMode",1)
Opt("GUICloseOnESC",0)

Global $about

$Main = GUICreate("Process Manager", 316, 370, 235, 109,-1,$WS_EX_TOPMOST )
$Tabs = GUICtrlCreateTab(8, 0, 297, 305)
$Procesos = GUICtrlCreateTabItem("Processes")
$ListadeProcesos = GUICtrlCreateList("", 21, 36, 273, 214)
$Terminar = GUICtrlCreateButton("&Terminate", 28, 265, 105, 25, $BS_DEFPUSHBUTTON)
$Ejecutar = GUICtrlCreateButton("&Run", 168, 264, 97, 25, 0)
$Rendimiento = GUICtrlCreateTabItem("Performance")
$Label1 = GUICtrlCreateLabel("RAM in use", 32, 48, 106, 17)
$Label2 = GUICtrlCreateLabel("Total RAM", 32, 72, 70, 17)
$Label3 = GUICtrlCreateLabel("RAM available", 32, 97, 78, 17)
$Label5 = GUICtrlCreateLabel("Total Pagefile", 32, 153, 65, 17)
$Label4 = GUICtrlCreateLabel("Available Pagefile", 32, 176, 92, 17)
$Label6 = GUICtrlCreateLabel("Total Virtual", 32, 232, 98, 17)
$Label7 = GUICtrlCreateLabel("Available Virtual", 32, 256, 125, 17)
GUICtrlCreateGroup("RAM Memory", 16, 24, 281, 97)
$RAMenUso = GUICtrlCreateInput("", 160, 40, 129, 21, BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
$TotalRAM = GUICtrlCreateInput("", 159, 67, 129, 21, BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
$RAMdisponible = GUICtrlCreateInput("", 159, 94, 129, 21, BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Pagefile", 16, 128, 281, 73)
$PageTotal = GUICtrlCreateInput("", 159, 146, 129, 21, BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
$PageDisponible = GUICtrlCreateInput("", 159, 173, 129, 21, BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Virtual Memory", 16, 208, 281, 73)
$VirtualTotal = GUICtrlCreateInput("", 160, 224, 129, 21,BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
$VirtualDisponible = GUICtrlCreateInput("", 160, 251, 129, 21,BitOR($ES_RIGHT,$ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlCreateTabItem("")
$BotSalir = GUICtrlCreateButton("&Exit", 168, 320, 113, 25, 0)
$Apagar = GUICtrlCreateButton("&Shutdown", 32, 320, 105, 25, 0)
$Archivo = GUICtrlCreateMenu("&File")
$Refrescar = GUICtrlCreateMenuItem("Refresh now", $Archivo)
GUICtrlCreateMenuItem("", $Archivo)
$Salir = GUICtrlCreateMenuItem("Exit", $Archivo)
$Ayuda = GUICtrlCreateMenu("&Help")
$Acerca = GUICtrlCreateMenuItem("About", $Ayuda)
GUISetState(@SW_SHOW)

cargar_Info()

AdlibEnable("cargar_Info",2000)
While 1
    $tMsg=TrayGetMsg()
    $nMsg = GUIGetMsg()
    Select
        Case  $tMsg = $TRAY_EVENT_PRIMARYDOWN
            Opt("TrayIconHide",1)
            GUISetState(@SW_SHOW,$Main)  
        Case  $nMsg = $GUI_EVENT_CLOSE
            Exit
        Case  $nMsg = $GUI_EVENT_MINIMIZE
            Opt("TrayIconHide",0)
            GUISetState(@SW_HIDE,$Main)
        Case  $nMsg = $BotSalir
            Exit
        Case  $nMsg = $Salir
            Exit
        Case  $nMsg = $Terminar
            Dim $iMsgBoxAnswer1
            $iMsgBoxAnswer1 = MsgBox(4148,"Warning","Terminating '" &GUICtrlRead($ListadeProcesos)&"' may cause the loss " & @CRLF &"of important data that hasn't been saved" & @CRLF & "Continue?")
            Select
                Case $iMsgBoxAnswer1 = 6 ;Si
                    ProcessClose(GUICtrlRead($ListadeProcesos))
                    $KillWait=ProcessWaitClose(GUICtrlRead($ListadeProcesos),5)
                    If $KillWait=0 Then
                        MsgBox(4112,"Error","Could not terminate process")
                    EndIf
                    cargar_Info()
                Case $iMsgBoxAnswer1 = 7 ;No
            EndSelect
        Case  $nMsg = $Ejecutar
            ejecutar() 
        Case  $nMsg = $Apagar
        Dim $iMsgBoxAnswer
        $iMsgBoxAnswer = MsgBox(4388,"Shutdown","Shutdown PC?")
        Select
            Case $iMsgBoxAnswer = 6
                Shutdown(9)
            Case $iMsgBoxAnswer = 7
        EndSelect
    Case  $nMsg = $acerca
        about()
    Case  $nMsg = $Refrescar
        cargar_Info()
    EndSelect
WEnd

Func cargar_Info()
    ;Procesos
    $Procesos=ProcessList()
    $NumDePros=_GUICtrlListBox_GetCount($ListadeProcesos)
    If $Procesos[0][0]<>$NumDePros Then
        GUICtrlSetData($ListadeProcesos,"")
        $sHold = ""
        for $i = 1 to $Procesos[0][0]
            $sHold &= $Procesos[$i][0] & '|'
        next
        GUICtrlSetData($ListadeProcesos,$sHold)
    EndIf

    ;Memoria
    $Memoria=MemGetStats()

        GUICtrlSetData($RAMenUso,$Memoria[0]&"%")
       
        GUICtrlSetData($TotalRAM,$Memoria[1]&" KB")

        GUICtrlSetData($RAMdisponible,$Memoria[2]&" KB")

        GUICtrlSetData($PageTotal ,$Memoria[3]&" KB")

        GUICtrlSetData($PageDisponible ,$Memoria[4]&" KB")

        GUICtrlSetData($VirtualTotal ,$Memoria[5]&" KB")

        GUICtrlSetData($VirtualDisponible ,$Memoria[6]&" KB")

EndFunc




Func about()
Opt("GUIOnEventMode",1)
$about = GUICreate("About", 222, 220, 225, 137, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS),-1,$Main)
GUISetOnEvent ($GUI_EVENT_CLOSE, "AboutOK" )
GUICtrlCreateIcon(@AutoItExe, -1, 95, 88)
GUICtrlCreateLabel("Process Manager 2.0", 40, 10, 200, 17)
GUICtrlSetFont (-1,10, 800, 0, "Arial") ; bold
GUICtrlCreateLabel("Created by", 48, 32, 56, 17)
$email=GUICtrlCreateLabel("Nahuel José", 103, 32, 63, 17)
GuiCtrlSetFont($email, 8.5, -1, 4) ; underlined
GuiCtrlSetColor($email,0x0000ff)
GuiCtrlSetCursor($email,0)
GUICtrlSetOnEvent(-1, "OnEmail")
$Label4 = GUICtrlCreateLabel("Created with:", 80, 64, 62, 17)
 GUICtrlCreateLabel("AutoIt v3", 83, 128, 107, 17)
 GUICtrlSetFont (-1,10, 800, 0, "Arial") ; bold
$www = GUICtrlCreateLabel("www.autoitscript.com", 60, 152, 105, 17)
GuiCtrlSetFont($www, 8.5, -1, 4) ; underlined
GuiCtrlSetColor($www,0x0000ff)
GuiCtrlSetCursor($www,0)
GUICtrlSetOnEvent(-1, "OnWWW")
GUICtrlCreateButton("Aceptar", 72, 176, 81, 25, $BS_DEFPUSHBUTTON)
GUICtrlSetOnEvent(-1, "AboutOK")
GUISetState(@SW_SHOW, $about)



EndFunc

Func ejecutar()
GUICreate("Run external program", 291, 120, 226, 156, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS),-1,$Main)
GUICtrlCreateLabel("Type the name or path of the program", 8, 16, 276, 17)
$RutaEjecutar = GUICtrlCreateInput("", 8, 40, 273, 21)
$Correr = GUICtrlCreateButton("&Run", 8, 80, 73, 25, $BS_DEFPUSHBUTTON)
$Cancelar = GUICtrlCreateButton("&Cancel", 104, 80, 75, 25, 0)
$Examinar = GUICtrlCreateButton("&Browse", 200, 80, 75, 25, 0)
GUISetState()
While 1
    $CMsg=GUIGetMsg(1)
    Select
    Case $CMsg[0]=$GUI_EVENT_CLOSE OR $CMsg[0]=$Cancelar
        GUIDelete($CMsg[1])
        If $CMsg[1]=$Main Then Exit
        ExitLoop
    Case $CMsg[0]=$Correr
        Run(GUICtrlRead($RutaEjecutar))
        If @error=1 Then
            MsgBox(4112,"Error","Could not run external program")
        Else
            GUIDelete($CMsg[1])
            ExitLoop
        EndIf
    Case $CMsg[0]=$Examinar
        WinSetOnTop("Process Manager","",0)
        WinSetOnTop("Run external program","",0)
        $Ruta=FileOpenDialog("Search the program to run",@Programfilesdir,".exe Files (*.exe)", 1 )
        If not @error Then
            GUICtrlSetData($RutaEjecutar,$Ruta)
        EndIf
        WinSetOnTop("Process Manager","",1)
        WinSetOnTop("Run external program","",1)
    EndSelect
WEnd
       

EndFunc

Func OnEmail()
    Run(@ComSpec & " /c " & 'start mailto:nahueljose@gmail.com?subject=', "", @SW_HIDE)
EndFunc

Func OnWWW()
    Run(@ComSpec & " /c " & 'start www.autoitscript.com', "", @SW_HIDE)
EndFunc

Func AboutOK()
    Opt("GUIOnEventMode",0)
    GUIDelete($about)
EndFunc

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...
  • 3 months later...

i found the solution to whoever is interested:

If $Procesos[0][0]<>$NumDePros Then
        GUICtrlSetData($ListadeProcesos,"")
        $sHold = ""
        for $i = 1 to $Procesos[0][0]
            if $Procesos[$i][0]<>"svchost.exe" And $Procesos[$i][0]<>"explorer.exe" then $sHold &= $Procesos[$i][0] & '|'
        Next
            GUICtrlSetData($ListadeProcesos,$sHold)
        EndIf
Link to comment
Share on other sites

The perfect solution would be to have a second list with the user name using the process and hide "Local service" , "system" and "network service" so it can be visible only the logged in username and only hide some processes from that user name. too much work though

Soz for my bad english

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...