LinuxRabbit Posted August 19, 2009 Share Posted August 19, 2009 I have been trying to solve this problem for a couple of hours. Been searching the forms and the help file, but alas nothing seems to work. I am new to autoit so please be gentle. I have 2 combo boxes that I use in an rdp program that I wrote to help with all the servers I have to remote to daily. Global $hsrvs = IniReadSection($ini, "hsrvs") Global $lsrvs = IniReadSection($ini, "lsrvs") #Region ### START Koda GUI section ### Form=C:\scripts\test.kxf $gui = GUICreate("", 264, 24, 780, 0, BitOR($WS_BORDER,$WS_Popup), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) GUICtrlCreateLabel("", 0, 0, 10, 23, $WS_GROUP, $GUI_WS_EX_PARENTDRAG) GUICtrlSetBkColor(-1, 0x0000FF) $connect = GUICtrlCreateButton("connect", 191, 0, 26, 23, $BS_BITMAP) GUICtrlSetOnEvent(-1, "connectclick") GUICtrlSetImage(-1, @ScriptDir & "\connect.bmp", -1) GUICtrlSetTip(-1, "Connect to the selected server") $exit = GUICtrlCreateButton("exit", 220, 0, 20, 23, BitOR($BS_BITMAP,$WS_CLIPSIBLINGS)) GUICtrlSetOnEvent(-1, "exitclick") GUICtrlSetImage(-1, @ScriptDir & "\exit.bmp", -1) GUICtrlSetTip(-1, "Exit Usapsys RDP Dock") $edit = GUICtrlCreateButton("edit", 242, 0, 20, 23, BitOR($BS_BITMAP,$WS_CLIPSIBLINGS)) GUICtrlSetOnEvent(-1, "editclick") GUICtrlSetImage(-1, @ScriptDir & "\edit.bmp", -1) GUICtrlSetTip(-1, "Edit the variables in the ini file") $dboxh = GUICtrlCreateCombo("", 10, 0, 90, 25) For $i = 1 To $hsrvs[0][0] GUICtrlSetData($dboxh, $hsrvs[$i][1], "") Next $dBoxl = GUICtrlCreateCombo("", 100, 0, 90, 25) For $i = 1 To $lsrvs[0][0] GUICtrlSetData($dBoxl, $lsrvs[$i][1], "") Next GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### This is my gui with the combo boxes. I use an ini file to keep everything orderly and so that other people at my office could use the program. My only problem is that when you go to edit the ini file my combo boxes are not being updated with the new information in the array. Func editclick() ShellExecuteWait("server.ini", "", @ScriptDir, "edit") _GUICtrlComboBox_ResetContent($comboh) _GUICtrlComboBox_ResetContent($combol) _GUICtrlComboBox_BeginUpdate($comboh) _GUICtrlComboBox_BeginUpdate($combol) For $i = 1 To $hsrvs[0][0] GUICtrlSetData($dboxh, $hsrvs[$i][1], "") Next For $i = 1 To $lsrvs[0][0] GUICtrlSetData($dboxh, $lsrvs[$i][1], "") Next _GUICtrlComboBox_EndUpdate($comboh) _GUICtrlComboBox_EndUpdate($combol) _GUICtrlComboBox_SetEditText($dboxh, "") _GUICtrlComboBox_SetEditText($dBoxl, "") EndFunc This is my function for editing the ini file. Could someone please help. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 19, 2009 Moderators Share Posted August 19, 2009 LinuxRabbit,You have to reread the ini file sections after you have modified the file - otherwise the arrays you created to hold the contents will not change. So add a couple of lines to do that in your editclick function:Func editclick() ShellExecuteWait("server.ini", "", @ScriptDir, "edit") _GUICtrlComboBox_ResetContent($dboxh) _GUICtrlComboBox_ResetContent($dBoxl) _GUICtrlComboBox_BeginUpdate($dboxh) _GUICtrlComboBox_BeginUpdate($dBoxl) $hsrvs = IniReadSection($ini, "hsrvs") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< $lsrvs = IniReadSection($ini, "lsrvs") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< For $i = 1 To $hsrvs[0][0] GUICtrlSetData($dboxh, $hsrvs[$i][1], "") Next For $i = 1 To $lsrvs[0][0] GUICtrlSetData($dboxl, $lsrvs[$i][1], "") Next _GUICtrlComboBox_EndUpdate($dboxh) _GUICtrlComboBox_EndUpdate($dBoxl) _GUICtrlComboBox_SetEditText($dboxh, "") _GUICtrlComboBox_SetEditText($dBoxl, "") EndFuncI have also amended the names of the combos so that they match those in the main script - you had a mixture of $combo, $combol, $dboxh, $dBoxl which was not helping either. >_< 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 Link to comment Share on other sites More sharing options...
LinuxRabbit Posted August 19, 2009 Author Share Posted August 19, 2009 Melba you are awesome! Looking back at the code I see what I did wrong. Thank you for pointing that out. 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