TheGh0st Posted February 8, 2007 Posted February 8, 2007 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) Else MsgBox(0, "IP Address", "Your External IP Address is: " & $PublicIP) EndIf
PaulIA Posted February 8, 2007 Posted February 8, 2007 (edited) Needs a bit of error checking, but... ConsoleWrite("192.168.10.100: " & SameGroup("192.168.10.100", "192.168.10.1", 3) & @CR) ConsoleWrite("192.168.20.100: " & SameGroup("192.168.20.100", "192.168.10.1", 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 endif next Return True EndFunc Edited February 8, 2007 by PaulIA Auto3Lib: A library of over 1200 functions for AutoIt
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now