Hello,
I would like to create a script that executes an Applescript when a specific static ip address is detected on the network. Is this possible, and how would I go about doing this. I apologize, but I am fairly new to Applescript.
Thank you in advance for your help,
googleman76
Good luck with that. Your Mac doesn’t know who else is on the LAN, your router does and it is probably not scriptable. Since you know the address you want to detect, you should use a "do shell script … " construction to ping it (see man “ping” on a repeating basis. One way to do this is with a stay-open “on idle” script:
on idle
-- check if the machine is running and answering pings
set Png to ""
set add to "10.0.1.4"
try
-- this takes a while if the machine is down
set Png to do shell script "ping -c 1 " & add
if Png contains "1 packets transmitted, 1 packets received" then
display dialog "Bingo" -- do your thing here
end if
end try
return 5 * minutes -- the repeat timing
end idle
This must be saved as a stay open script. When running, it will appear in the dock. Quit it from the dock.
Thanks, I’ll try it, I really appreciate it