Rav1 Posted June 1, 2014 Posted June 1, 2014 Hey guys, I'm working on project to get the wireless interface name into a variable and put that into netsh so that I can set a network with priority=1. I'm having a hard time finding the right way to get the wireless interface name. I am using stringmid but I am thinking that this is not the way to go. Is there a better way to get this? ConsoleWrite(_getDOSOutput('netsh wlan show interfaces') & @CRLF) Func _getDOSOutput($command) Local $text = '' Local $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4) While 1 $text &= StdoutRead($Pid) If @error Then ExitLoop Sleep(10) WEnd Global $iName = StringMid($text,71,15) MsgBox(0, "", $iName) EndFunc thanks
Solution jguinch Posted June 1, 2014 Solution Posted June 1, 2014 (edited) Have a look at my >network configuration UDF #include <Network.au3> $aAdapters = _GetNetworkAdapterList() For $i = 0 To UBound($aAdapters) - 1 If _IsWirelessAdapter($aAdapters[$i][0]) Then ConsoleWrite("Wireless interface name : " & $aAdapters[$i][1] & @CRLF) Next Edited June 1, 2014 by jguinch Reveal hidden contents Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Rav1 Posted June 1, 2014 Author Posted June 1, 2014 Thanks for the reply. Unfortunately, that lists what my network adapter is (Marvell Avastar 350n Wireless Network Controller). I'm looking for the actual "user friendly" name of the connection, which is called "wi-fi" on my pc. netsh uses this name in it's command to set the priority of a network. I went through the functions in the udf but I could not find one that lists this name. Its a very cool udf though....
jguinch Posted June 1, 2014 Posted June 1, 2014 (edited) Well, I edited my last post. Look at the result of this simple code : #include <Array.au3> #include <Network.au3> $aAdapters = _GetNetworkAdapterList() _ArrayDisplay($aAdapters ) Edited June 1, 2014 by jguinch Reveal hidden contents Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
Rav1 Posted June 1, 2014 Author Posted June 1, 2014 Cool, thanks man. I saw the change you made and I get it now. I'm new to this stuff and I haven't had a chance to mess with array's yet. Thanks for the lesson. neat stuff!
jguinch Posted June 1, 2014 Posted June 1, 2014 You can mark the topic as solved, if it is.. Reveal hidden contents Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
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