AutoHotkey Community

It is currently May 27th, 2012, 1:16 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: IP Comare
PostPosted: January 11th, 2010, 2:53 pm 
Offline

Joined: June 29th, 2009, 7:59 pm
Posts: 35
Hello Everyone,

I'm trying to compare my current IP address. I think I found a few scripts others have wrote, but I believe they are outputting it to a file first. I would like to compare without outputting it to a file. I though I could you the below script, but it doesn't seem to be working. What am I doing wrong?

Code:
{
if (A_IPAddress1 or A_IPAddress2 or A_IPAddress3 or A_IPAddress4) = "10*.*.*.*"
msgbox, Good to Go
else
msgbox, Error
}
Msgbox, %A_IPAddress1%`n%A_IPAddress2%`n%A_IPAddress3%`n%A_IPAddress4%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2010, 3:03 pm 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
If doesn't support such syntax, try this:
Code:
pattern := "10\d{0,1}.\d{1,3}.\d{1,3}.\d{1,3}"
If (RegExMatch(A_IPAddress1, pattern, match) || RegExMatch(A_IPAddress2, pattern, match)
||  RegExMatch(A_IPAddress3, pattern, match) || RegExMatch(A_IPAddress4, pattern, match))
  MsgBox Good to go
Else
  MsgBox Error

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2010, 3:42 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
use if var in matchlist
Code:
matchlist.= A_IPAddress1 "," A_IPAddress2 "," A_IPAddress3 "," A_IPAddress4
If IP in %matchlist%
   MsgBox Yay

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 11th, 2010, 4:30 pm 
Offline

Joined: June 29th, 2009, 7:59 pm
Posts: 35
Thanks guys I knew you would have the answers :)!!!!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], iDrug, Leef_me, Ohnitiel and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group