AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

IP Comare

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
cjsmile999



Joined: 29 Jun 2009
Posts: 35

PostPosted: Mon Jan 11, 2010 1:53 pm    Post subject: IP Comare Reply with quote

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%
Back to top
View user's profile Send private message
tonne



Joined: 06 Jun 2006
Posts: 1651
Location: Denmark

PostPosted: Mon Jan 11, 2010 2:03 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Mon Jan 11, 2010 2:42 pm    Post subject: Reply with quote

use if var in matchlist
Code:
matchlist.= A_IPAddress1 "," A_IPAddress2 "," A_IPAddress3 "," A_IPAddress4
If IP in %matchlist%
   MsgBox Yay

_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
cjsmile999



Joined: 29 Jun 2009
Posts: 35

PostPosted: Mon Jan 11, 2010 3:30 pm    Post subject: Reply with quote

Thanks guys I knew you would have the answers Smile!!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group