I have been trying to make Apple Script check if the computer is connected to the internet by getting its IPv4 address. I have tried the following:
tell application "system events" get IPv4 address
system info IPv4 address
Try this out… this should work for you
try
set theIP to do shell script "curl ifconfig.co"
set the clipboard to theIP
activate
display dialog "Your Current IP Address Is.." & linefeed & theIP & linefeed ¬
& "It Has Been Copied To Your Clipboard" with icon 2 buttons ¬
"OK" default button 1 with title "Your Current IP Address Is.." giving up after 10
on error
display dialog "You Have No Internet Connection" buttons {"Cancel", "OK"} default button "OK"
end try