MattX Posted November 30, 2005 Share Posted November 30, 2005 Got a combo box working with a user.ini file - funny thing is now is the msgbox line I have put in to check that the relevant user is being selected is comming up with an answer of' 4' and not the selected user. Anyone got an idea why ? #include <GuiConstants.au3> GUICreate("Select User", 250, 66) $combo = GUICtrlCreateCombo("", 16, 8, 225, 21) GUICtrlSetData($combo, "") $selectbutton = GUICtrlCreateButton("Select", 100, 40, 60, 20) GUISetState() $userlist = IniReadSection("c:\usersini.ini", "Users") If @error Then MsgBox(4096, "", "Error occured, probably no INI file.") Else For $i = 1 To $userlist[0][0] $tmp = $userlist[$i][1] & "|" GUICtrlSetData($combo, $tmp) Next EndIf While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $selectbutton MsgBox(0, "You chose", $selectbutton) ;DriveMapDel("n:") ;DriveMapAdd("n:", "\\server" & $selectbutton, 0, "domain" & $selectbutton, "password") EndSelect WEnd Exit Link to comment Share on other sites More sharing options...
GaryFrost Posted November 30, 2005 Share Posted November 30, 2005 (edited) Got a combo box working with a user.ini file - funny thing is now is the msgbox line I have put in to check that the relevant user is being selected is comming up with an answer of' 4' and not the selected user. Anyone got an idea why ? #include <GuiConstants.au3> GUICreate("Select User", 250, 66) $combo = GUICtrlCreateCombo("", 16, 8, 225, 21) GUICtrlSetData($combo, "") $selectbutton = GUICtrlCreateButton("Select", 100, 40, 60, 20) GUISetState() $userlist = IniReadSection("c:\usersini.ini", "Users") If @error Then MsgBox(4096, "", "Error occured, probably no INI file.") Else For $i = 1 To $userlist[0][0] $tmp = $userlist[$i][1] & "|" GUICtrlSetData($combo, $tmp) Next EndIf While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $selectbutton MsgBox(0, "You chose", $selectbutton) ;DriveMapDel("n:") ;DriveMapAdd("n:", "\\server" & $selectbutton, 0, "domain" & $selectbutton, "password") EndSelect WEnd Exit Because your showing the controld id MsgBox(0, "You chose", GuiCtrlRead($selectbutton)) Edited November 30, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
MattX Posted November 30, 2005 Author Share Posted November 30, 2005 Because your showing the controld idMsgBox(0, "You chose", GuiCtrlRead($selectbutton))Even weirder now - the result is always 'select' !! Picking this up from the: $selectbutton = GUICtrlCreateButton("Select", 100, 40, 60, 20) line. Link to comment Share on other sites More sharing options...
MattX Posted November 30, 2005 Author Share Posted November 30, 2005 Even weirder now - the result is always 'select' !! Picking this up from the: $selectbutton = GUICtrlCreateButton("Select", 100, 40, 60, 20) line.Changed it to MsgBox(0, "You chose", GuiCtrlRead($combo))and I get the correct result - next task is to somehow use that variable for the drive mapping.... Link to comment Share on other sites More sharing options...
BigDod Posted November 30, 2005 Share Posted November 30, 2005 Changed it to MsgBox(0, "You chose", GuiCtrlRead($combo)) and I get the correct result - next task is to somehow use that variable for the drive mapping....$user=GuiCtrlRead($combo) MsgBox(0, "You chose", $user) Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother 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