Jump to content

Array into combobox


Lempke
 Share

Recommended Posts

Can't get this to work? Don't know where the problem is.

Combobox stays empty

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

Opt("GUIOnEventMode", 1)
Opt("TrayIconDebug", 1)

Dim $MemberList1
Dim $GroupsList1

GUICreate("Group Members", 320, 500)

$Combo3 = GUICtrlCreateCombo("", 20, 90, 280, 20)

_FileReadToArray(@TempDir & "\QueryGroups.txt", $GroupsList1)
_ArrayDisplay($GroupsList1, "Groups")
    
For $x = 1 to $GroupsList1[0]
    $GroupsList1[$x] = StringLeft($GroupsList1[$x], StringInStr($GroupsList1[$x], ",ou=") -1)
    $GroupsList1[$x] = StringTrimLeft($GroupsList1[$x], 4)  
    $GroupsList1[$x] = StringReplace($GroupsList1[$x], "\", "")
    GUICtrlSetData($Combo3, "|" & $GroupsList1[$X] & "|")
Next
    
GUISetState()

While 1
    Sleep(500)
WEnd

UPDATE:

I've solved the problem.

GUICtrlSetData($Combo3, "|" & $GroupsList1[$X] & "|")

_GUICtrlComboAddString($Combo3, $GroupsList1[$X])

Edited by Lempke
Link to comment
Share on other sites

Don't know if it would work but give it a try:

#include <Array.au3>
#include <File.au3>
#include <GuiConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("TrayIconDebug", 1)
Dim $MemberList1
Dim $GroupsList1
GUICreate("Group Members", 320, 500)
$Combo3 = GUICtrlCreateCombo("", 20, 90, 280, 20)
_FileReadToArray(@TempDir & "\QueryGroups.txt", $GroupsList1)

For $x = 1 to $GroupsList1[0]
    $var = StringInStr($GroupsList1[$x], ",ou=")    
    $var1 = StringLeft($GroupsList1[$x], $var -1)
    $var2 = StringTrimLeft($var1, 4)    
    $var3 = StringReplace($var2, "\", "")       
    GUICtrlSetData($Combo3, $var3 & "|") 
Next    
GUISetState()
While 1 
    Sleep(500)
WEnd

Neo

[center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center]

Link to comment
Share on other sites

  • Moderators

GUICtrlSetData($Combo3, & $GroupsList1[$X] & "|")

Doesn't throw you an error?

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

Don't know if it would work but give it a try:

Neo

Nope, doesn't work. The combobox still stays empty. I think the different variables are not the problem.

I have used this in an other script for a Editbox and it works fine there

For $x = 1 to $MemberList1[0]
    $MemberList1[$x] = StringLeft($MemberList1[$x], StringInStr($MemberList1[$x], ",ou=") -1)
    $MemberList1[$x] = StringTrimLeft($MemberList1[$x], 4)
    $MemberList1[$x] = StringReplace($MemberList1[$x], "\", "")
    GUICtrlSetData($EditBox1, $MemberList1[$X] & @CRLF, 1)
Next
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...