In the script I wrote, I wish to add the ability to ping for connectivity or check a LAN IP address.
I have no issues posting my script so it can be added to, as long as comments are added.
#Check OS version, must be Mavericks
set currentVersion to system version of (system info)
if (currentVersion begins with "10.9") then
#01/06/2014; Changed Dialogs to alerts; accept for the incompatible OS dialog. Looks better.
display alert "I found your OS to be Mavericks. You're good to go."
else
if (currentVersion does not start with "10.9") then
display dialog "incompatible OS. The OS found is not mavericks. This application requires mavericks to run. Please consider installing Mavericks then re-run this application again." buttons {"Quit"} default button 1 with icon stop
error number -128
end if
end if
#WAN IP Script. Version 1.2
#Written for OS X Mavericks only
#Retrieves your public IP and copies it to the clipboard.
#Written by Daniel Chavez. Copyright (C) 2014 by Daniel Chavez. All rights
#Display a welcome and open-source alert.
display alert "WAN IP Application. By Daniel Chavez. Copyright (C) 2014 by Daniel Chavez. All rights reserved. This application is open-source and can be modified, subject to the GPL V2 license."
#Script Begin
WanIP()
display alert "Your IP Address is" & WanIP() & "And has been copied to your clipboard."
set the clipboard to WanIP()
on WanIP()
set WIP to missing value
repeat with thissite in siteList
try
set WIP to item 1
of paragraphs of (
do shell script "curl " &
thissite & " | tr -cs '[0-9\\.]' '
\\012' | awk -F'.' 'NF==4 && $1>0 && $1<256 && $2<256 && $3<256 && $4<256 && !/\\.\\./'")
if WIP is not missing value then exit repeat
end try
end repeat
return WIP
end WanIP
#Buttons
display alert "Thank you for using this application. If you liked using this application, please consider donating by visiting the application website and clicking on donate. Any amount donated would be greatly appreciated.
Would you like to file a bug report? Visit the main application website?Or quit?" buttons {"FileBugReport", "VisitApplicationWebSite", "Quit"}
set the button_pressed to the button returned of the result
if the button_pressed is "VisitApplicationWebSite" then
open location VisitApplicationWebSite
else
if the button_pressed is "FileBugReport" then
open location FileBugReport
else
if the button_pressed is "Quit" then
error number -128
end if
end if
end if