Jump to content
Sign in to follow this  


Recommended Posts

Could someone point me in the right direction.

This function no longer works with the beta. (Still can't get my head around stringregexp!)


Func _GetMAC($getmacindex = 1)
    $ipHandle = Run(@ComSpec & ' /c ipconfig /all', '', @SW_HIDE, 2)
    Local $stream
    While NOT @error
        $stream = $Stream & StdoutRead($ipHandle)
    $macdashed = StringRegExp(StringStripWS($stream, 3), '([0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2}-[0-9A-F]{2})', 3)

    If Not @extended Then Return 0
    If Not IsArray($macdashed) Then Return 0
    If $getmacindex = 0 Then Return UBound($macdashed)
    If $getmacindex < - 1 Then Return 0
    If $getmacindex > UBound($macdashed) Or $getmacindex = -1 Then $getmacindex = UBound($macdashed)
    $macsemicolon = StringReplace($macdashed[$getmacindex - 1], '-', ':', 0)
    Return $macsemicolon

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  

  • Create New...