Continue with AppleScript only if certain machine is on local network?

Is it possible in a script to check to see if a certain machine is on the local network, and only continue to to run the script if it is?

I worked it out - sorry for the SAQ

set connected to (do shell script "ping -o -t 5 macbook.local >/dev/null && echo yes || echo no") as boolean
if not connected then
	display dialog "machine macbook is NOT connected."
	error number -128
end if