Jump to content

Recommended Posts

Posted

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

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

Posted

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!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...