Sign in to follow this  
Followers 0
Rav1

Getting wireless interface name

6 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by jguinch

Share this post


Link to post
Share on other sites

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....

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by jguinch

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0