Liste in Combo Box

  • hioh
    ich möchte gerne eine ComboBox mit namen füllen...bekomme das aber irgendwie nicht hin X(
    das is einfach mal mein Beispiel script

    [autoit]

    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Form1", 159, 35, 302, 218)
    $Combo1 = GUICtrlCreateCombo("Combo1", 8, 8, 145, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit][autoit][/autoit][autoit]

    EndSwitch
    WEnd

    [/autoit]

    und ich möchte das dort in der Box alle .XX dateien im Speicher verzeichnis aufgeführt werden. Also alle Mp3s jpg's oder so...

    Einmal editiert, zuletzt von halloman (1. Oktober 2009 um 19:25)

  • Hallo halloman,

    schau dir halt mal andere Skripte an z.B.: Musterumgebung von Alina, benutze dann die Hilfe zu den Funktionen (F1 in Scite drücken über der Funktion) die du nicht verstehst. Wenn du dann noch Fragen hast meldest du dich nocheinmal

    mfg (Auto)Bert

  • nee
    du hast mich falsch verstanden...ich habe kein Problem damit in die Combobox was reinzuschreiben
    ich wieß nur nich wie ich die Datei Namen dort rein bekomme

  • Spoiler anzeigen
    [autoit]

    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <File.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Form1", 159, 35, 302, 218)
    $Combo1 = GUICtrlCreateCombo("Combo1", 8, 8, 145, 25)
    $list1 = _FileListToArray(@ScriptDir, "*", 1)

    [/autoit] [autoit][/autoit] [autoit]

    for $i = 1 to $list1[0] Step 1
    GUICtrlSetData($Combo1, $list1[$i])
    Next
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]

    Oder sind noch Ordner enthalten die du auch mit auslesen willst?

  • danke jeztt kann ichs selber so machen wie ichs brauch...
    genau gesagt brauch ich im script dir + \Profiles Ordner die .ini Dateien die er anzeigen soll

  • habe es jetzt soweit... jetz möchte ich nur noch das er nicht anzeigt XXX.ini sondern nur XXX also nur den namen

    [autoit]

    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <File.au3>

    [/autoit][autoit][/autoit][autoit]

    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Form1", 159, 35, 302, 218)
    $Combo1 = GUICtrlCreateCombo("Combo1", 8, 8, 145, 25)
    $list1 = _FileListToArray(@ScriptDir & "\Profiles", "*.ini", 1)

    [/autoit][autoit][/autoit][autoit]

    for $i = 1 to $list1[0] Step 1
    GUICtrlSetData($Combo1, $list1[$i])
    Next
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit][autoit][/autoit][autoit]

    EndSwitch
    WEnd

    [/autoit]
  • Und wieder der Verweis auf die Hilfe

    Schau Dir mal StringTrimRight an....

    Hier Dein Script

    Spoiler anzeigen
    [autoit]

    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <File.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Form1", 159, 35, 302, 218)
    $Combo1 = GUICtrlCreateCombo("Combo1", 8, 8, 145, 25)
    $list1 = _FileListToArray(@ScriptDir & "\Profiles", "*.ini", 1)

    [/autoit] [autoit][/autoit] [autoit]

    if @error Then
    msgbox (0,"","Keine Datei gefunden")

    Else
    for $i = 1 to $list1[0] Step 1
    $ex = StringTrimRight($list1[$i], 4)
    GUICtrlSetData($Combo1, $ex)
    Next

    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]
  • Hallo holloman,

    schau dir mal die Hilfe zu StringTrimRight an, du kannst aber auch StringSplit oder Stringreplace nehmen,

    [autoit]

    $text = StringReplace("TestuserProfile.ini", " ".ini "")
    MsgBox(0, "Der neue String", $text)

    [/autoit]

    mfg (Auto)Bert

  • Oder mit StringSplit

    Spoiler anzeigen
    [autoit]

    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <File.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Form1", 159, 35, 302, 218)
    $Combo1 = GUICtrlCreateCombo("Combo1", 8, 8, 145, 25)
    $list1 = _FileListToArray(@ScriptDir & "\Profiles", "*.ini", 1)

    [/autoit] [autoit][/autoit] [autoit]

    if @error Then
    msgbox (0,"","Keine Datei gefunden")
    Else
    for $i = 1 to $list1[0] Step 1
    $ex = StringSplit($list1[$i],".")

    GUICtrlSetData($Combo1, $ex[$ex[0]])
    Next

    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]
  • ja danke
    jetzt möchte ich noch dieses ausgewählte file benutzen...
    sprich mit Openfile und dann aus Combo
    Problem dabei ist wenn ich ihn aus der Combo box lesen lasse komt nich XXX.ini sondern einfach nur eine Zahl

  • Auslesen kannst du es mit GUICTRLREAd
    und das .ini kannst du mit

    $pfad = $read & ".ini"

    $read = handle des GUICTRLREad

  • mm soo? er soll aus der Datei halt mit Iniread was rauslesen

    [autoit]

    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <File.au3>

    [/autoit][autoit][/autoit][autoit]

    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Form1", 159, 35, 302, 218)
    $Combo1 = GUICtrlCreateCombo("Combo1", 8, 8, 145, 25)
    $list1 = _FileListToArray(@ScriptDir & "\Profiles", "*.ini", 1)

    [/autoit][autoit][/autoit][autoit]

    if @error Then
    msgbox (0,"","Keine Datei gefunden")

    [/autoit][autoit][/autoit][autoit]

    Else
    for $i = 1 to $list1[0] Step 1
    $ex = StringTrimRight($list1[$i], 4)
    GUICtrlSetData($Combo1, $ex)
    Next

    [/autoit][autoit][/autoit][autoit]

    EndIf

    [/autoit][autoit][/autoit][autoit]

    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit][autoit][/autoit][autoit]

    EndSwitch
    WEnd

    [/autoit][autoit][/autoit][autoit]

    Func _start()
    $read = GUICtrlRead($Combo1)
    $pfad = $read & ".ini"
    $FileIni = IniReadSection($pfad, "XXX")
    EndFunc

    [/autoit]
  • Du musst den ordner in den pfad auch noch einbauen also

    [autoit]

    Func _start()
    $read = GUICtrlRead($Combo1)
    $pfad = @Scriptdir & "/Profiles/" &$read & ".ini"
    $FileIni = IniReadSection($pfad, "XXX")
    EndFunc

    [/autoit]