Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'An AppleScript to obtain the WAN IP address' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to obtain the WAN IP address
Authored by: bostmass on Nov 14, '04 03:01:36AM
Thought this might be a nice one-line addition to copy the answer to the clipboard. WanIP()

display dialog "Copy this IP to clipboard? " default answer WanIP()
set the clipboard to WanIP()

on WanIP()
    set WIP to missing value
    set siteList to {"http://checkip.dyndns.org/", "http://whatismyip.com", "http://www.whatismyipaddress.com",
        "http://ipid.shat.net/", "http://www.edpsciences.comhtbin/ipaddress", "http://www.showmyip.com/"}
    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

[ Reply to This | # ]