acana007 Posted October 28, 2006 Posted October 28, 2006 I am making a simple gui process list app. i just need to know how to use the command. ProcessList any examples would be appreciated
Rad Posted October 28, 2006 Posted October 28, 2006 (edited) Helpfile + examples + testing is the best way for info#Include <GUIConstants.au3> ;Includes the information that allows you to create windows and controls $Window = GUICreate("Process Inspector", 528, 258+25) ;The main window $List = GUICtrlCreateList("",2,2,524,262) ;Creates a large white box which lists strings in it $ButtonRefresh = GUICtrlCreateButton("Refresh", 30,260,462,20) GUISetState() ;Enables your window so its visible While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $ButtonRefresh Then GUICtrlDelete($List) ;Recreates the list to $List = GUICtrlCreateList("",2,2,524,262) ;quickly clear the data $Processes = ProcessList() For $i = 1 To $Processes[0][0] GUICtrlSetData($List,$Processes[$i][0]) Next EndIf WEndA bit more info I guessWhen you use ProcessList you use it like: "$Variable = ProcessList()"Then to get a process name use $Variable[x][0], and the handle swap 0 for 1. The X is a number, greated than 0 which is the process name....$Variable[0][0] is the number of processes returned. You can use this as the max in a loop, like I did Edited October 28, 2006 by Rad
acana007 Posted October 28, 2006 Author Posted October 28, 2006 Helpfile + examples + testing is the best way for info #Include <GUIConstants.au3> ;Includes the information that allows you to create windows and controls $Window = GUICreate("Process Inspector", 528, 258+25) ;The main window $List = GUICtrlCreateList("",2,2,524,262) ;Creates a large white box which lists strings in it $ButtonRefresh = GUICtrlCreateButton("Refresh", 30,260,462,20) GUISetState() ;Enables your window so its visible While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $ButtonRefresh Then GUICtrlDelete($List) ;Recreates the list to $List = GUICtrlCreateList("",2,2,524,262) ;quickly clear the data $Processes = ProcessList() For $i = 1 To $Processes[0][0] GUICtrlSetData($List,$Processes[$i][0]) Next EndIf WEnd A bit more info I guess When you use ProcessList you use it like: "$Variable = ProcessList()" Then to get a process name use $Variable[x][0], and the handle swap 0 for 1. The X is a number, greated than 0 which is the process name.... $Variable[0][0] is the number of processes returned. You can use this as the max in a loop, like I did this helps alot thank you. one more question for you when it generates the list how can i make it display only certian 1's eg. smc.exe msnmsgr.exe so like this if smc.exe is running then add it to the list but add it as Sygate PFW if msnmsger.exe is running then add it to the list but add it as MSN
Rad Posted October 28, 2006 Posted October 28, 2006 Uh... If $Process[x][0] = "msnmsgr.exe" Then $ProcessName[x] = "MSN" Endif I could see using one of those for all of your programs could work... but that would be really hard for doing all the major programs... and long.. not so much hard but long Doesnt sound right at all, anyways, long but not very hard
Moderators SmOke_N Posted October 28, 2006 Moderators Posted October 28, 2006 Hmm, @Rad.. that's an example? Must be an old one. I'm not a fan of deleting and recreating controls if not necessary.... try this quick and dirty re-do of the above.$MainGUI = GUICreate("Process Inspector", 528, 283) $hList = GUICtrlCreateList("", 2, 2, 524, 262) $hButton = GUICtrlCreateButton("Refresh", 30, 260, 462, 20) GUISetState() While 1 Switch GUIGetMsg() Case - 3 Exit Case $hButton GUICtrlSetData($hList, '') $aPL = ProcessList() For $iCC = 1 To UBound($aPL) - 1 $sLoadList = 'Process: ' & $aPL[$iCC][0] & ' :::::::::: PID: ' & $aPL[$iCC][1] GUICtrlSetData($hList, $sLoadList) Next EndSwitch WEnd Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Rad Posted October 28, 2006 Posted October 28, 2006 Well, I just threw it together and didnt want to spend to much time on it, and I've had a problem with it just making this really big list the more you press refresh, so I did what I knew worked... anyways, go for his he knows more than me >: )
Moderators SmOke_N Posted October 28, 2006 Moderators Posted October 28, 2006 Well, I just threw it together and didnt want to spend to much time on it, and I've had a problem with it just making this really big list the more you press refresh, so I did what I knew worked... anyways, go for his he knows more than me >: )It wasn't a "stab" at you, I was really curious if that was a help file example. If it is, we are not helping ourselves if our help file examples are early 3.1 release/beta much for support questions. I forgot there was even an example file folder. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
acana007 Posted October 28, 2006 Author Posted October 28, 2006 it doesnt show me that msnmsgr is MSN it doesnt work help #Include <GUIConstants.au3> ;Includes the information that allows you to create windows and controls $Window = GUICreate("Process Inspector", 528, 258+25) ;The main window $List = GUICtrlCreateList("",2,2,524,262) ;Creates a large white box which lists strings in it $ButtonRefresh = GUICtrlCreateButton("Refresh", 30,260,462,20) GUISetState() ;Enables your window so its visible While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $ButtonRefresh Then GUICtrlDelete($List) ;Recreates the list to $List = GUICtrlCreateList("",2,2,524,262) ;quickly clear the data $Processes = ProcessList() For $i = 1 To $Processes[0][0] GUICtrlSetData($List,$Processes[$i][0]) Next EndIf If $Process[x][0] = "msnmsgr.exe" Then $ProcessName[x] = "MSN" Endif WEnd
Rad Posted October 28, 2006 Posted October 28, 2006 Ok heres a 1-line way to make your processes, its pretty strange try to understand... #Include <GUIConstants.au3> ;Includes the information that allows you to create windows and controls Dim $string[1] $Window = GUICreate("Process Inspector", 528, 258+25) ;The main window $List = GUICtrlCreateList("",2,2,524,262) ;Creates a large white box which lists strings in it $ButtonRefresh = GUICtrlCreateButton("Refresh", 30,260,462,20) GUISetState() ;Enables your window so its visible While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If $msg = $ButtonRefresh Then GUICtrlDelete($List) ;Recreates the list to $List = GUICtrlCreateList("",2,2,524,262) ;quickly clear the data $Processes = ProcessList() ReDim $string[$Processes[0][0] + 1] ;+1 because $Processes starts at 1, 0 is the quantity For $i = 1 To $Processes[0][0] If $Processes[$i][0] = "msnmsgr.exe" Then $string[$i] = "MSN" ;Include all your processes like this above... If $string[$i] = "" Then $string[$i] = $Processes[$i][0] ;...this line here GUICtrlSetData($List,$string[$i]) Next EndIf WEnd
acana007 Posted October 28, 2006 Author Posted October 28, 2006 thank you i will try to get it to do what i want it to do if i need more help i may ask
Rad Posted October 28, 2006 Posted October 28, 2006 To revert back to the actual process name, the $Processes[X][0] and $String[X] should be msnmsgr.exe // MSN, so the X should be the same
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