Insomniac420 Posted December 30, 2013 Posted December 30, 2013 (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 December 30, 2013 by Insomniac420
Moderators Melba23 Posted December 30, 2013 Moderators Posted December 30, 2013 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Insomniac420 Posted December 30, 2013 Author Posted December 30, 2013 (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 December 30, 2013 by Insomniac420
jdelaney Posted December 30, 2013 Posted December 30, 2013 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.
Moderators JLogan3o13 Posted December 30, 2013 Moderators Posted December 30, 2013 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() "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Solution Insomniac420 Posted December 30, 2013 Author Solution Posted December 30, 2013 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
Skysnake Posted May 26, 2014 Posted May 26, 2014 (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 May 26, 2014 by Skysnake Skysnake Why is the snake in the sky?
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