craigholohan Posted November 6, 2006 Posted November 6, 2006 Hi Guys and Gals, I am trying to get extract selected text in a combo box. The code below is just a simple example of what I am trying to get at, I figured if I can get it to display in a message I can then add it to my main code. Basically what I need is to get the text selected in the Combo Box so I can use it in below scenario: This is what I have: RunWait(@ComSpec & " /c " & 'netsh interface ip set address name= "Wireless Network Connection" static '& $IPAddressMessage &' '& $SubNetMessage &' '& $GatwayMessage &' 1' , "", @SW_HIDE) This is what I want: RunWait(@ComSpec & " /c " & 'netsh interface ip set address name= "& $Available_Connections & " static '& $IPAddressMessage &' '& $SubNetMessage &' '& $GatwayMessage &' 1' , "", @SW_HIDE) So depending on what Network Connections are available I can select the one I want to run the netsh command on. Hope this makes sense and someone can help me cause I am pulling my hair out again. Please see what I have Opt ("GUIOnEventMode", 1) #Include <GuiConstants.au3> Global $connection Global $objwmiservice = ObjGet('winmgmts:\\localhost\root\CIMV2') Local $Main_Form = GUICreate("My test GUI", 300,100,-1,-1) GUICtrlCreateGroup("Select Network connection", 5, 5, 280, 50) Local $NIC_Conect = GUICtrlCreateCombo ("Select profile ---", 15,25,150) Local $Available_Connections = GUICtrlRead($NIC_Conect) Local $connection = $objWMIService.ExecQuery ('SELECT * FROM Win32_NetworkAdapter', 'WQL', 0x10 + 0x20) If IsObj($connection) Then For $wmiServices In $connection If $wmiServices.netconnectionstatus = 2 Then GUICtrlSetData($NIC_Conect, $wmiServices.netconnectionid) GUISetState() Next EndIf GUICtrlCreateGroup("", -99, -99, 1, 1) ;Buttons ;======== $testNIC_Read=GUICtrlCreateButton ("Read Selected", 170,24,90,22) GUICtrlSetOnEvent($testNIC_Read,"_testConnection") $Exit = GUICtrlCreateButton ("Exit Test",100,60,80,30) GUICtrlSetOnEvent($Exit,"_Exit") ;Functions ;========= Func _testConnection() MsgBox(64,"Quick NIC Changer", $Available_Connections) EndFunc Func _Exit() Exit EndFunc While 1 Sleep(5000) WEnd [END CODE] Tanks in advance, Craig
Developers Jos Posted November 6, 2006 Developers Posted November 6, 2006 You read the Control before its even filled with values. You need to do a GUICTRLREAD() when the event is triggered. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
craigholohan Posted November 6, 2006 Author Posted November 6, 2006 You read the Control before its even filled with values. You need to do a GUICTRLREAD() when the event is triggered.Wow it was that easy, thanks JdeB.I am a newbee and quit qlueless with some of the stuff but thanks all the same for the quick help.Craig
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