Check your current IP address with AppleScript
This script will get your current “real world” IP address. It’s very useful when you’re using a router giving out internal addresses and you need to know the address the world is seeing for you. It will also store that IP address so you can have this script run on a schedule and only report if your IP address has changed.
Click here to download the script
[codesyntax lang=”applescript” lines=”no”]
property theIP : “”
set TheResult to (do shell script “curl -f http://checkip.dyndns.org”)
set Olddelim to AppleScript’s text item delimiters
try
set AppleScript’s text item delimiters to “Current IP Address: ”
set LongIP to item 2 of every text item of TheResult as text
set AppleScript’s text item delimiters to “”
set stopPoint to (offset of “< " in LongIP)
set myip to characters 1 through (stopPoint - 1) of LongIP as text
if theIP is "" then
set theIP to myip
display dialog "Your IP is : " & myip
end if
if myip is not equal to theIP then
display dialog "Your IP is : " & myip
set theIP to myip
end if
set AppleScript's text item delimiters to Olddelim
on error
set AppleScript's text item delimiters to Olddelim
end try
[/codesyntax]
webmaster :: Aug.27.2007 :: Applescript, Management :: No Comments »