Jump to content

Know connction on pc


Recommended Posts

Hi to all, i want to add to my script a "connection detector". For example see this photo:

Posted Image

How you can see, there are two connection setting on pc...there are a metod to detect that with autoit.

I need that becouse i want create a "pppoe connection creator", for switch the ip faster =)

Hi!

Link to comment
Share on other sites

Try this

#include <Array.au3>

$avNetworkConnections = _GetNetworkConnections ( )
 _ArrayDisplay ( $avNetworkConnections )

Func _GetNetworkConnections ( )
    Local Const $NETWORK_CONNECTIONS = 49
    Local $objShell = ObjCreate ( "Shell.Application" )
    Local $objFolder = $objShell.Namespace ( $NETWORK_CONNECTIONS )
    Local $objFolderItem = $objFolder.Self
    Local $aRetArr[2] = [1, $objFolderItem.Path]
    Local $ColItems = $objFolder.Items
    Local $iUbound = 0
    For $objItem In $ColItems
        $iUbound = UBound ( $aRetArr )
        ReDim $aRetArr[$iUbound+1]
        $aRetArr[$iUbound] = $objItem.Name
    Next
    $aRetArr[0] =$iUbound
    Return $aRetArr
EndFunc ;==> _GetNetworkConnections ( )

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Thanks that seems to work...now another question =P. There is a way to know if one of these detect connection, is an pppoe connection?...

#include <Constants.au3>

ConsoleWrite ( "_IpConfigAll : " & _IpConfigAll ( ) & @Crlf )

Func _IpConfigAll ( )
    Local $_Pid, $_StdoutRead = ""
    $_Pid = Run ( "ipconfig /all", @SystemDir, @SW_HIDE, $STDOUT_CHILD )
    While ProcessExists ( $_Pid )
        $_StdoutRead &= StdoutRead ( $_Pid )
    Wend
    Return StringStripWS ( $_StdoutRead, 7 )
EndFunc ;==> _IpConfigAll ( )

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

#include <Constants.au3>

ConsoleWrite ( "_IpConfigAll : " & _IpConfigAll ( ) & @Crlf )

Func _IpConfigAll ( )
    Local $_Pid, $_StdoutRead = ""
    $_Pid = Run ( "ipconfig /all", @SystemDir, @SW_HIDE, $STDOUT_CHILD )
    While ProcessExists ( $_Pid )
        $_StdoutRead &= StdoutRead ( $_Pid )
    Wend
    Return StringStripWS ( $_StdoutRead, 7 )
EndFunc ;==> _IpConfigAll ( )

Thanks for the code, but this script tell me if the current connection is set on pppoe mode. But i would to know if in all connection, detect by programm (active connection or not)..., there are a pppoe connection. Like as a pppo detector for action or not detection.

But thanks for your hard help =)

Link to comment
Share on other sites

Thanks for the code, but this script tell me if the current connection is set on pppoe mode. But i would to know if in all connection, detect by programm (active connection or not)..., there are a pppoe connection. Like as a pppo detector for action or not detection.

But thanks for your hard help =)

Sorry, any ideas !

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
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
 Share

  • Recently Browsing   0 members

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