|
|
 |  |
Re: applescript library?From: tony Date: Monday, August 19, 2002
Time: 9:35:18 am=46ind & Replace IP Address
property toFind : ""
property toReplace : ""
property gTimeout : 900 -- timeout for opening large zones on slow
servers (default =3D 15 minutes)
set validAnswer to false
repeat until validAnswer is true
display dialog "Find what? Please enter a valid IP address"
default answer toFind
set toFind to the text returned of the result
if not my validIP(toFind) then
display dialog "Please enter a valid IP address" with
icon caution
else
set validAnswer to true
end if
end repeat
set validAnswer to false
repeat until validAnswer is true
display dialog "Replace with what? Please enter a valid IP
address" default answer toReplace
set toReplace to the text returned of the result
if not my validIP(toReplace) then
display dialog "Please enter a valid IP address" with
icon caution
else
set validAnswer to true
end if
end repeat
tell application "QuickDNS Pro Manager"
activate
set allZones to name of every =ABclass ZONE=BB whose =ABclass PTYP=BB
is =ABconstant ZTYPMast=BB and =ABclass PENA=BB is true
repeat with theZone in allZones
with timeout of gTimeout seconds
set theDoc to =ABevent QDN4EOPN=BB =ABclass ZONE=BB
(theZone as string)
end timeout
tell theDoc
set totalARecords to the count of every =ABclass AREC=BB
if totalARecords > 100 then
try
say ((totalARecords as text)
& " records to examine in " & name of theDoc)
end try
end if
repeat with i from 1 to totalARecords
set theRecord to (a reference to
=ABclass AREC=BB i)
if the =ABclass PIPN=BB of theRecord =3D
toFind then set the =ABclass PIPN=BB of theRecord to toReplace
set recordsCounted to (i / 100)
try
if recordsCounted =3D (integer
recordsCounted) then say (i as text)
end try
end repeat
try
close saving yes
end try
end tell
end repeat
end tell
on validIP(theValue)
set theOctets to {}
set newOctet to ""
set errorCondition to false
repeat with c in (theValue & ".")
if not errorCondition then
if c is in "." then
set theOctets to theOctets & newOctet
set newOctet to ""
else if c is in "0123456789" then
set newOctet to newOctet & c
else
set errorCondition to true
end if
end if
end repeat
if not errorCondition then
if (count of theOctets) is not 4 then
set errorCondition to true
else
repeat with theOctet in theOctets
if not errorCondition then
set theOctet to (theOctet as number)
if (theOctet < 0 or
theOctet > 255) then set errorCondition to true
end if
end repeat
end if
end if
return (not errorCondition)
end validIP
>Chris,
>
>Correct me if I'm wrong, but isn't there an applescript to make zone
>record changes? I have been unsuccessful in finding it (say, I want
>to change the primary IP address for a collection of zones). Where
>is it on the website? If it isn't on the website, that'd be a great
>place for it.. but I'd be just as happy to see it show up as an
>attachment from you, please. (I did find the export domains script
>and the other script in the support folders...)
>
>thx
>
>paul vail
--
|

Return to Digital Point Solutions' Home Page |