Bodman Posted September 1, 2009 Share Posted September 1, 2009 Hi, I am creating a drop down box from a ini file, but I would only like to show the fields populated and not the empty ones at the end. Anyone know if this is possible. (See pic) This is the ini file [sites] Site1=Site Number 1 URL1=http://www.url1.com Site2= URL2= Site3= URL3= Site4= URL4= Site5= URL5= expandcollapse popup#include <GuiConstants.au3> ;Read sites and URL's from ini file $site1 = IniRead("ecap.ini", "Sites", "Site1", "") $URL1 = IniRead("ecap.ini", "Sites", "URL1", "") $site2 = IniRead("ecap.ini", "Sites", "Site2", "") $URL2 = IniRead("ecap.ini", "Sites", "URL2", "") $site3 = IniRead("ecap.ini", "Sites", "Site3", "") $URL3 = IniRead("ecap.ini", "Sites", "URL3", "") $site4 = IniRead("ecap.ini", "Sites", "Site4", "") $URL4 = IniRead("ecap.ini", "Sites", "URL4", "") $site5 = IniRead("ecap.ini", "Sites", "Site5", "") $URL5 = IniRead("ecap.ini", "Sites", "URL5", "") ;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 & "|" & $site3 & "|" & $site4 & "|" & $site5 ,"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 = $site1 Then run( "notepad.exe","") EndSelect WEnd Link to comment Share on other sites More sharing options...
picaxe Posted September 1, 2009 Share Posted September 1, 2009 Tryexpandcollapse popup#include <GuiConstants.au3> ;Read sites and URL's from ini file $site1 = IniRead("ecap.ini", "Sites", "Site1", "") $URL1 = IniRead("ecap.ini", "Sites", "URL1", "") $site2 = IniRead("ecap.ini", "Sites", "Site2", "") $URL2 = IniRead("ecap.ini", "Sites", "URL2", "") $site3 = IniRead("ecap.ini", "Sites", "Site3", "") $URL3 = IniRead("ecap.ini", "Sites", "URL3", "") $site4 = IniRead("ecap.ini", "Sites", "Site4", "") $URL4 = IniRead("ecap.ini", "Sites", "URL4", "") $site5 = IniRead("ecap.ini", "Sites", "Site5", "") $URL5 = IniRead("ecap.ini", "Sites", "URL5", "") ;Create Menu $GUI_Handle = GUICreate("Ecap", 199, 41, (@DesktopWidth - 199) / 2, (@DesktopHeight - 41) / 2) $Combo_1 = GUICtrlCreateCombo("Select", 10, 10, 140, 21) $sCombo = "" For $i = 1 To 5 $j = Eval("site" & $i) If $j <> "" Then $sCombo &= $j & "|" Next StringTrimRight($sCombo, 1) GUICtrlSetData($Combo_1, $sCombo, "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 = $site1 Then Run("notepad.exe", "") EndSelect WEnd Link to comment Share on other sites More sharing options...
Bodman Posted September 1, 2009 Author Share Posted September 1, 2009 Great thanks for that Picaxe it seems to work very well. My script is now nearly working //Bod Link to comment Share on other sites More sharing options...
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