Jump to content
Sign in to follow this  

Comparing Ipaddress!

Recommended Posts

I'm trying to find if an ip address is on the correct group

if @ipaddress1 = "192.168.10.??? <<< ---- PROBLEM HERE of what I need. I don't care what the ??? are as long as its in the

192.168.10 <--- area

MsgBox(0, "IP Address", "Your Internal IP Address is: " & @IPAddress1)


MsgBox(0, "IP Address", "Your External IP Address is: " & $PublicIP)


Share this post

Link to post
Share on other sites

Needs a bit of error checking, but...

ConsoleWrite(" " & SameGroup("", "", 3) & @CR)
ConsoleWrite(" " & SameGroup("", "", 3) & @CR)

Func SameGroup($sIPAddress, $sMaster, $iLevel)
  Local $iI, $aIPAddress, $aMaster

  $aIPAddress = StringSplit($sIPAddress, ".")
  $aMaster    = StringSplit($sMaster   , ".")
  for $iI = 1 to $iLevel
    if $aIPAddress[$iI] <> $aMaster[$iI] then
      Return False
  Return True
Edited by PaulIA

Auto3Lib: A library of over 1200 functions for AutoIt

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...