Sign in to follow this  
Followers 0
MrQ

Help with proces list

4 posts in this topic

#1 ·  Posted (edited)

Hello, i am new to autoit and i have some problems. If someone can help i will apreciate very much

Can someone provide me a short example on how to get all processes in a list ? I just can' t get them into a list.

Thank you.

Edited by MrQ

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello, i am new to autoit and i have some problems. If someone can help i will apreciate very much

Can someone provide me a short example on how to get all processes in a list ? I just can' t get them into a list.

Thank you.

This will put all of the processes in a 2-dimensional array. I have included blindwigs ArrayBox function so you can see what is inside the array... but the line:

$a_List = ProcessList()

is all that is important.

#include <Array.au3>
#include <GuiConstants.au3>

$a_List = ProcessList()
_ArrayBox($a_List, 1, "Process List")


;===============================================================================
;
; Function Name: _ArrayBox()
; Description: Shows an array in a GUI window. Improved version of _ArrayDisplay
; Parameter(s): $Array - An array, 1d or 2d, 0-based or 1-based
; $ArrayBase - 1 or 0 - tells what base the array is
; $sTitle - the title to put on the output window
; $Width, $Height, $Left, $Top - Set the size and position of the output window
; Requirement(s): $Array must be 1d or 2d. If 1-based, then arraysize is assumed to be $Array[0] or $Array[0][0]
; Return Value(s): -1 = $Array is not an array, error=1
; Author(s): Mike Ratzlaff <mike@ratzlaff.org>
; Revision: 20050620A
;
;===============================================================================
;
Func _ArrayBox(ByRef $Array, $ArrayBase = 1, $sTitle = 'Array Box', $Width = 200, $Height = 200, $Left = -1, $Top = -1)
    Dim $AllDone = 0, $msg, $i, $j, $ArrayDimensions = UBound($Array, 0)
    Dim $hndForm_Main, $hndListView_Display
    
    If $ArrayDimensions = 0 Then
        SetError(1)
        Return -1
    EndIf
    
    ;Setup
    If $ArrayBase <> 0 Then $ArrayBase = 1
    If $ArrayBase Then
        Select
            Case $ArrayDimensions = 1
                $ArrayMax = $Array[0]
            Case $ArrayDimensions = 2
                $ArrayMax = $Array[0][0]
        EndSelect
    Else
        $ArrayMax = UBound($Array, 1) - 1
    EndIf
    
    ;Create GUI
    If $Height < 100 Then $Height = 100
    If $Width < 100 Then $Width = 100
    $hndForm_Main = GUICreate($sTitle, $Width, $Height, $Left, $Top, BitOR($WS_POPUP, $WS_CAPTION, $WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_EX_DLGMODALFRAME))
    
    ;Create List Box
    If $ArrayDimensions = 1 Then
        $sTemp = 'Index|Value'
    ElseIf $ArrayDimensions = 2 Then
        $sTemp = 'Index'
        For $i = 0 To UBound($Array, 2) - 1
            $sTemp = $sTemp & '|' & $i
        Next
    EndIf
    $hndListView_Display = GUICtrlCreateListView($sTemp, 0, 0, $Width, $Height - 24, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL))
    GUICtrlSetResizing($hndListView_Display, BitOR($GUI_DockLeft, $GUI_DockTop, $GUI_DockRight, $GUI_DockBottom))
    
    ;Create Controls, Show GUI
    $hndButton_Close = GUICtrlCreateButton('&Close', $Width - 80, $Height - 24, 80, 24)
    GUICtrlSetResizing($hndButton_Close, BitOR($GUI_DockRight, $GUI_DockBottom, $GUI_DockSize))
    GUICtrlSetState($hndButton_Close, $GUI_DefButton)
    GUISetState(@SW_SHOW, $hndForm_Main)
    
    ;Display Array
    Select
        Case $ArrayDimensions = 1 ;1-Dimensional Array
            For $i = $ArrayBase To $ArrayMax
                GUICtrlCreateListViewItem($i & '|' & $Array[$i], $hndListView_Display)
            Next ;$i
        Case $ArrayDimensions = 2 ;2-Dimensional Array
            For $i = $ArrayBase To $ArrayMax
                $sTemp = $Array[$i][0]
                For $j = 1 To UBound($Array, 2) - 1
                    $sTemp = $sTemp & '|' & $Array[$i][$j]
                Next ;$j
                GUICtrlCreateListViewItem('[' & $i & ']|' & $sTemp, $hndListView_Display)
            Next ;$i
        Case Else ;Unhandled Type
            
    EndSelect
    
    ;Wait for user to close box
    Do
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                $AllDone = 1
            Case $msg = $hndButton_Close
                $AllDone = 1
        EndSelect
    Until $AllDone
    GUIDelete($hndForm_Main)
    Return 0
EndFunc   ;==>_ArrayBox
Edited by Simucal

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

$list = ProcessList()
for $i = 1 to $list[0][0]
  msgbox(0, $list[$i][0], $list[$i][1])
next

Edited by Bundy

Share this post


Link to post
Share on other sites

$list = ProcessList()
for $i = 1 to $list[0][0]
  msgbox(0, $list[$i][0], $list[$i][1])
next
uhhhh... that is what I did? Except I hate displaying 2dimensional arrays in a series of msgboxes.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

Share this post


Link to post
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
Sign in to follow this  
Followers 0