Sign in to follow this  
Followers 0
hellAT

Name of Network interface?

4 posts in this topic

Hello, has anyone an idea the get the (current) name of the network interface? That's what you can see by "ipconfig"...

/Karsten

Share this post


Link to post
Share on other sites

If what you are asking is to see the "ipconfig" information you can try this out.

Global $IpconfigOutputOnce

$ipconfig_output = Run(@ComSpec & " /c ipconfig /all", '', @SW_HIDE, 2)
While 1
    $ipconfig_data = StdoutRead($ipconfig_output)
    If @error Then ExitLoop
    If $ipconfig_data Then
        $IpconfigOutputOnce &= $ipconfig_data
    Else
        Sleep(10)
    EndIf
WEnd
$IpconfigOutputOnce = StringStripWS($IpconfigOutputOnce, 7)

MsgBox(0, "IPCONFIG /ALL", $IpconfigOutputOnce)

Share this post


Link to post
Share on other sites

okay, i thought there's something built-in autoit. But anyway, this helps, thanks!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

okay, i thought there's something built-in autoit. But anyway, this helps, thanks!

I think it is also kept in the registry if i remember correctly.

I made this a long time ago when i was trying to learn autoit http://www.techidiots.net/autoit-scripts/ipset.rar/view, But this basically does what the above post states (except with netsh)

_RunDOS("netsh inter show interface > " & $tempfile)
While 1
    $text = FileReadLine($tempfile, $line)
    If @error = -1 Then ExitLoop
    If StringTrimRight(StringTrimLeft($text, 30), StringLen(StringTrimLeft($text, 30)) - 9) = "Dedicated" Then
        GUICtrlSetData($connections, StringTrimLeft($text, 47) & "|")
    EndIf
    $line = $line + 1
WEnd

Edit

Global $IpconfigOutputOnce

$ipconfig_output = Run(@ComSpec & " /c ipconfig /all", '', @SW_HIDE, 2)
While 1
    $ipconfig_data = StdoutRead($ipconfig_output)
    If @error Then ExitLoop
    If $ipconfig_data Then
        $IpconfigOutputOnce &= $ipconfig_data
    Else
        Sleep(10)
    EndIf
WEnd
$IpconfigOutputOnce = StringStripWS($IpconfigOutputOnce, 7)

MsgBox(0, "IPCONFIG /ALL", $IpconfigOutputOnce)

I didn't know you could use StdoutRead to get the output of run...good to know :-)

Edited by ACalcutt

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

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