Sign in to follow this  
Followers 0
Insomniac420

Adding process list array to combobox

7 posts in this topic

#1 ·  Posted (edited)

Ok im a little rusty w/ Autoit its been a while, please i would like to ask how to add the names of any running windows processes to be listed into a combobox for a simple gui ty sorry for the waist of time...

$client = GUICtrlCreateCombo("Game Client Process", 48, 80, 121, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$proclist=WinList()
GuiCtrlSetData($client,_ArrayToString($proclist))

So i used somthing similar for an array consisting of file names from a certain directory to be added to a combobox and it works like so:

$Filecombolist = GUICtrlCreateCombo("Select File", 48, 128, 121, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$FileList = _FileListToArray(@ScriptDir, "*")
GuiCtrlSetData($Filecombolist,_ArrayToString($FileList))

 Ty again for your help sorry for the inconvenience.

Edited by Insomniac420

Share this post


Link to post
Share on other sites



Insomniac420,

ProcessList (which is what you will need to list the processes, not WinList) returns a 2D array - _ArrayToString only works on 1D arrays. :(

You will have to write your own function to get the data into a suitable format - a simple loop concatenating the [#][0] elements should do the trick. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You will have to write your own function to get the data into a suitable format - a simple loop concatenating the [#][0] elements should do the trick. ;)

 

So can i just do somthing more simple then just use $proclist=ProcessList() witch will give me all windows processes in a 2 D array. Then have it list all the arrays in the combo box     "I really dont care if it shows the PID also as long as it shows the names"

 

Or maybe can u give me a example script so i can better undersatand your reply. I understand why its not working but still u points me to no examples of a func that will loop concatenating the [#][0] elements

 

Sorry again for my noob questions its been a while...

I am also trying to come up with a way to use somthing like StringSplit ( "string", "delimiters" [, flag = 0] ) to help my siuation but i dont think it will help any

ty again and sorry

Edited by Insomniac420

Share this post


Link to post
Share on other sites

Here you go.  You can logically skip those windows with no titles:

#include <Array.au3>
$a = WinList()

Local $a2[UBound($a)-1]
Local $a3[UBound($a)-1]
For $i = 1 To UBound($a)-1
    $a2[$i-1]="Window=[" & $a[$i][0] & "]"
    ; or concat the 2d to one
    $a3[$i-1]="Window=[" & $a[$i][0] & "] Handle=[" & $a[$i][1] & "]"
Next

_ArrayDisplay($a2)
_ArrayDisplay($a3)

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

As for adding it to your GUI, you should be able to do something like this:

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Local $msg

GUICreate("Test", 300, 300)
$sCombo = GUICtrlCreateCombo("", 10, 10, 280, 40)
$aList = WinList()
    For $i = 1 To UBound($aList) - 1
        If $aList[$i][0] <> "" Then $var = GUICtrlSetData($sCombo, $aList[$i][0])
    Next


GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
            Select
                Case $msg = $GUI_EVENT_CLOSE
                    ExitLoop
            EndSelect
    WEnd

GUIDelete()

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Wow ty this worked great

 

As for adding it to your GUI, you should be able to do something like this:

#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Local $msg

GUICreate("Test", 300, 300)
$sCombo = GUICtrlCreateCombo("", 10, 10, 280, 40)
$aList = WinList()
    For $i = 1 To UBound($aList) - 1
        If $aList[$i][0] <> "" Then $var = GUICtrlSetData($sCombo, $aList[$i][0])
    Next


GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
            Select
                Case $msg = $GUI_EVENT_CLOSE
                    ExitLoop
            EndSelect
    WEnd

GUIDelete()

Wow ty this worked perfect it simple and easy good job and ty everyone for your fast responce times. Nice example

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thank you for this.

It has taken me a week to find out how to get an Array into a Combo box.

There are examples of how to use a Combo box and there is extensive documentation on Arrays, but nowhere is there an example showing how to get an Array into a Combo box.

Perhaps it can be included as an example in the help file under GUICtrlCreateCombo 'Advanced Example'

Thank you for a great product.

Edited by Skysnake

Skysnake

Why is the snake in the sky?

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