Re: Wan IP Retrieval No Longer Works For Me Under OS X 10.11
Re: Wan IP Retrieval No Longer Works For Me Under OS X 10.11
- Subject: Re: Wan IP Retrieval No Longer Works For Me Under OS X 10.11
- From: Jim Weisbin <email@hidden>
- Date: Wed, 28 Oct 2015 15:06:26 -0400
email@hidden wrote: So now I'm stuck, as the exact code I just posted (see above), doesn't work. The internet connection test code (when taken out) doesn't fix the issue, so my thinking is that there must be a newer way for the Wan IP address retrieval to occur in OS X 10.11, but I've not been able to figure it out as of yet. Any help is much appreciated. Thanks.
This is the code I've been using. I don't have 10.11 to test, but this might work for you:
tell application "Finder" set internalIP to "" set my_interface to "" try set my_interface to do shell script "netstat -rn -f inet | egrep \"^default\" | awk '{print $6}' " display dialog my_interface if [my_interface is equal to ""] then error "no default interface found" else set internalIP to do shell script "ipconfig getifaddr " & my_interface end if on error set internalIP to "internal IP not found, or no default interface found" end try display dialog internalIP end tell
Jim Weisbin | C.T.O. | human |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden