Sign in to follow this  
Followers 0
Bodman

Create drop down from variable

3 posts in this topic

Hi, Im trying to create a drop down menu from a set of variables that I am pulling from a ini file. I can do this no problem if I used fixed txt names but from variables they all list in one line. Any help greatly appreciated.

post-52553-12514511356989_thumb.jpg

#include <GuiConstants.au3>
;Read sites and URL's from ini file
$site1 = IniRead("ecap.ini", "Sites", "Site1", "NotFound")
$URL1 = IniRead("ecap.ini", "Sites", "URL1", "NotFound")
$site2 = IniRead("ecap.ini", "Sites", "Site2", "NotFound")
$URL2 = IniRead("ecap.ini", "Sites", "URL2", "NotFound")


;Create Menu
$GUI_Handle = GuiCreate("Ecap", 199, 41,(@DesktopWidth-199)/2, (@DesktopHeight-41)/2)

$Combo_1 = GUICtrlCreateCombo("Select", 10, 10, 140, 21)
GUICtrlSetData($Combo_1 , $site1 & $site2 & "|Site 3|Site 4|Site 5|Site 6|Site 7|Site 9|Site 10|Site 11|Site 12|","Select")
$Button_2 = GuiCtrlCreateButton("OK", 160, 10, 30, 20)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit

        Case $msg = $Button_2
            GUICtrlRead($Combo_1)
            $Menustate  = GUICtrlRead($Combo_1)
            MsgBox(4096, "Result", $Menustate)
If $menustate = ("Belfast")   Then run( "notepad.exe","")

    EndSelect
WEnd

Share this post


Link to post
Share on other sites



You forgot the |.

GUICtrlSetData($Combo_1 , $site1 & "|" & $site2 & "|Site 3|Site 4|Site 5|Site 6|Site 7|Site 9|Site 10|Site 11|Site 12|","Select")

Thank you. I have tried so many combinations and just couldn't find it :D

//Bod

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