I have a login script that maps my network drives on my company network, but I don't want this script to run on my home network since it errors out each time.

Is there a way I can create a script that pings my company server and if it is not available then it does not run my login script?

This is what my login script looks like now

delay 5
mount volume "smb://server/share1"
mount volume "smb://server/share2"
mount volume "smb://server/share3"