Nahuel Posted August 9, 2007 Share Posted August 9, 2007 (edited) This is a process manager that I made. It's my first 'serious' script. I'd like you all to check it out and tell me what you think.I think it turned out pretty cool, I'm sorry for the variables and functions in spanish, but the rest is all in english.Some things:*It's 'always on top'*It refreshes the list of processes every 1.5 seconds*The window is stretchable*It's simple and effective*It checks if the typed or selected process is currently running or if no process has been selected or typed*I did it all by myself and the help file and I like it.*UPDATED**Added Shutdown and Run functions*Set the "Terminate" button as defaultexpandcollapse popup;~ =================================================== ;~ First version of 'Task Manager' ;~ Created by Nahuel Jose ;~ nahueljose@gmail.com ;~ ==================================================== #include <Guiconstants.au3> $AnchoVentana=300 $AltoVentana=380 $Izquierda=20 $Arriba=20 $AnchoLista=$AnchoVentana - $Izquierda*2 $AnchoBoton=($AnchoVentana/3)-16 $AltoInputBox = 21 $Separador = 55 $Separador2 = 20 $AltoLista=$AltoVentana - (2*$AltoInputBox + 2*$Separador) $Lista=ProcessList() GUICreate("Process Manager",$AnchoVentana,$AltoVentana,-1,-1,$WS_SIZEBOX,$WS_EX_TOPMOST) $ListaProcesos=GUICtrlCreateList("",$Izquierda,$Arriba,$AnchoLista,$AltoLista) $ProcesoAMatar=GUICtrlCreateInput("",$Izquierda,$AltoLista+$Separador,$AnchoLista,$AltoInputBox) $Matar=GUICtrlCreateButton("Terminate",$Izquierda,$AltoLista+$AltoInputBox+$Separador + $Separador2,$AnchoBoton,$AltoInputBox,$BS_DEFPUSHBUTTON);Crea el botón. $Ejecutar=GUICtrlCreateButton("Run",$Izquierda+$Anchoboton+5,$AltoLista+$AltoInputBox+$Separador + $Separador2,$AnchoBoton,$AltoInputBox) $Apagar=GUICtrlCreateButton("Shutdown",$Izquierda+2*$Anchoboton+10,$AltoLista+$AltoInputBox+$Separador + $Separador2,$AnchoBoton,$AltoInputBox) GUICtrlCreateGroup("Processes",5,5,$AnchoVentana-10,$AltoLista+20) GUICtrlCreateGroup("Process to terminate/run",5,$AltoLista+28,$AnchoVentana-10,100) GUISetState() Opt("RunErrorsFatal",0) cargar_lista() $MediElTiempo = False While 1 if Not $MediElTiempo Then $Empezar = TimerInit() $MediElTiempo = True EndIf $dif = TimerDiff($Empezar) if $dif>1500 Then cargar_lista() $MediElTiempo = False EndIf $msg=GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $ListaProcesos GUICtrlSetData($ProcesoAMatar,GUICtrlRead($ListaProcesos)) Case $msg = $Ejecutar Run(GUICtrlRead($ProcesoAMatar)) If @error=1 Then MsgBox(4144,"Error","Could not run external program") Else GUICtrlSetData($ProcesoAMatar,"Running!") Sleep(700) GUICtrlSetData($ProcesoAMatar,"") EndIf Case $msg = $Apagar Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(4388,"Shutdown","Shutdown PC?") Select Case $iMsgBoxAnswer = 6 ProcessClose("explorer.exe") Shutdown(9) Case $iMsgBoxAnswer = 7 EndSelect Case $msg = $Matar If GUICtrlRead($ProcesoAMatar)="" Then MsgBox(4144,"Error","You must select a process to terminate") Else $Check=ProcessExists(GUICtrlRead($ProcesoAMatar)) If $Check <> 0 Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(4148,"Warning","By terminating the process '" &GUICtrlRead($ProcesoAMatar)&"' you may lose" & @CRLF &"important data" & @CRLF & "Continue?") Select Case $iMsgBoxAnswer = 6 ;Si terminar_proceso(GUICtrlRead($ProcesoAMatar)) ProcessWaitClose(GUICtrlRead($ProcesoAMatar),5) cargar_lista() GUICtrlSetData($ProcesoAMatar,"") Case $iMsgBoxAnswer = 7 ;No EndSelect Else MsgBox(4144,"Error","The process '"&GUICtrlRead($ProcesoAMatar)&"' does not exist or it's not currently running") EndIf EndIf EndSelect WEnd Func terminar_proceso($kill) ProcessClose($kill) EndFunc Func cargar_lista() $Procesos=ProcessList() GUICtrlSetData($ListaProcesos,"") for $i = 1 to $Procesos[0][0] GUICtrlSetData($ListaProcesos,$Procesos[$i][0]) next EndFuncI want opinions, suggestions and critics if you don't mind.Compiled version with stupid icon attached.(Also updated) Edited August 9, 2007 by Nahuel Link to comment Share on other sites More sharing options...
Generator Posted August 9, 2007 Share Posted August 9, 2007 It looks nice, but maybe few more functions could be added, such as run, shut down, etc, also fix the tray icon, other than that looks nice. Link to comment Share on other sites More sharing options...
gseller Posted August 9, 2007 Share Posted August 9, 2007 Looks good, would be nice to have it where it refreshes withoug jumping.. LOL Other than tha, the features Generator mentioned would make it much better. Link to comment Share on other sites More sharing options...
Nahuel Posted August 9, 2007 Author Share Posted August 9, 2007 Looks good, would be nice to have it where it refreshes withoug jumping.. LOL Other than tha, the features Generator mentioned would make it much better.haha yeah! That's why I had to make the window stretchable. Another thing that bothers me, is that when you select some process, it gets 'deselected' when the list refreshes. The process has already been marked for terminating though. It just doesn't look nice.I like the idea of adding the Run and ShutDown functions. I'll do that, thanks a lot guys! Link to comment Share on other sites More sharing options...
Nahuel Posted August 9, 2007 Author Share Posted August 9, 2007 It looks nice, but maybe few more functions could be added, such as run, shut down, etc, also fix the tray icon, other than that looks nice.Thanks for the suggestion. Good idea.I added those functiones and updated the post and the compiled version attached.This is addicting Link to comment Share on other sites More sharing options...
jaenster Posted August 24, 2007 Share Posted August 24, 2007 it lags, but nice if you dont have access for the taskmgr -jaenster Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now