Jump to content

Process list


 Share

Recommended Posts

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

Edited by Rad
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :whistle:

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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 >: )

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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

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
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...