Pinging IP trouble
I am very new to Applescript and have ran into a problem. I am trying to set up a script that will constantly ping all ip adresses on my network. I deally I would want this script to run all the time. Whenever it finds one of three specific ip addresses, I would like it to perform a task. IN this case just say the date. If it doesnt find one of the three specific IP adresses then I'd like it to keep searching. And lastely if it finds a different IP adresses than the three specific ones, I'd like it to notify me.
My problem is that I can get it to search for only one address. If it finds that adress right off the bat then I'm good. If it doesn't then I get a applescript error that says my ping timeout. It does not even go to the else if statment, it simply ends my code. I also can not get the reapeat function to work. I tried in another script and it just kept repeating over and over again even if the ping successfully found the ip adress the first time.
The xxx.xxx.x.xxx in my code if my ip adress and they are the same. I really need for it to search not just for mine but for two other specific ones.
set myhour to get the (hours of (current date)) as string
set myminutes to get the (minutes of (current date)) as string
set mydate to date string of (current date)
set ping to (do shell script "ping -c 2 xxx.xxx.x.xxx)
if ping contains "xxx.xxx.x.xxx" then
tell application "iCal"
view calendarat (my (current date))
switch viewtoday view
activate
end tell
say "[[rate 160]] [[pitch 50]]Today is " & mydate using "Vicki"
say "[[rate 160]] [[pitch50]] The time is " & myhour & ":" & myminutes using "Vicki"
else if ping contains "timeout" then
say "User not found"
end if
Mac OS X (10.6.8)