Re: Validate IP Address
Re: Validate IP Address
- Subject: Re: Validate IP Address
- From: Tom Jones <email@hidden>
- Date: Sun, 12 Feb 2006 13:21:25 -0800
Cool, this gives me a good place to start.
Thanks,
tom
On Feb 12, 2006, at 12:58 PM, Timothy Bates wrote:
IPs are of the form
n.n.n.n
where n is a number between 0 and 255
So you want to
1. Split on "."
2. Count what you get: there should be 4 items
3 Check each item is an integer between 0 and 255
This would be a start
set a to "123.123.123"
set oldDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set x to text items of a
set AppleScript's text item delimiters to oldDelimiters
--return count x
if (count x) ≠ 4 then
display dialog "I need 4 numbers separated by periods (not " &
(count x)
& ").
Your string was: " & a
end if
I'm working on a small apple script which will set a systems IP
address. I have it pop up a dialog to enter the address and that
works fine. But What I'm need of is a way to validate the IP address
is in the correct format.
does anyone have an example on how I can validate the IP address?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (Applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40acworld.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden