IP Veiwer script

tell application "System Events"
	
	delay 0
	set myIPAddress to (do shell script "curl http://checkip.dyndns.org/ | tr -cs '[0-9\\.]' '\\012' | awk -F'.' 'NF==4 && $1>0 && $1<256 && $2<256 && $3<256 && $4<256 && !/\\.\\./'")
	display dialog "My IP Address Is: " & myIPAddress
end tell

Model: Macbook Pro
AppleScript: Version 2.3 (118)
Browser: Firefox 9.0.1
Operating System: Mac OS X (10.6)

or


display dialog "My IP Address Is: " & (do shell script "curl http://whatismyip.org")

or

display dialog "The Current IP Address is " & word 25 of (do shell script "curl checkip.dyndns.org")

Oh well that works too lol, i used the variable because it was a part of my other script,

tell application "System Events"
	tell application "Mail"
		activate
		set myEmail to text returned of (display dialog "To: " default answer "")
		set myIPAddress to (do shell script "curl checkip.dyndns.org")
		set newMessage to make new outgoing message with properties {subject:"IP Address", content:"My IP Address Is: " & result, visible:false}
		tell newMessage
			make new to recipient at end of every to recipient with properties {address:myEmail}
			delay 0
			send
			display dialog "Your IP Address Is: " & word 25 of myIPAddress
		end tell
	end tell
end tell

Model: Macbook Pro
AppleScript: Version 2.3 (118)
Browser: Firefox 9.0.1
Operating System: Mac OS X (10.6)

what about a script that finds the IP on the network page in system preferences that’s the IP I need in order to get a script I’'m working on to work.

do you mean the IPv4 address?

IPv4 address of (system info)

I am using this and it worked for me :slight_smile:

set macInfo to system info
set macName to computer name of macInfo
set macIpAddress to IPv4 address of macInfo
set username to long user name of macInfo


set AppleScript's text item delimiters to {"Domain Name:"}
try (* get rid of unavailable domain *)
	set macDomainName to paragraph 1 of text item 2 of networkInfo
on error
	set macDomainName to "unknown"
end try
set AppleScript's text item delimiters to {" "}

set userInfo to {}
set the end of userInfo to {"Computer Name: ", macName} as text

set the end of userInfo to {"User Name: ", username} as text

set AppleScript's text item delimiters to return & return


set theIP to do shell script "ifconfig | grep  'broadcast' | awk '{print $2}'"
try
	set ip1 to first paragraph of theIP
on error
	set ip1 to ""
end try

try
	set ip2 to second paragraph of theIP
on error
	set ip2 to ""
end try

try
	if ip1 = "" and ip2 = "" then
		display dialog (userInfo as text) & return & return & "You do not seem to be connected to any network.Please connect your computer to a network and try again."
	else
		display dialog (userInfo as text) & return & return & "Primary IP       : " & ip1 & return & return & "Secondary IP   : " & ip2
	end if
end try

Model: Mac Mini & Mac Book Pro
AppleScript: 2.4.1
Operating System: Mac OS X (10.7)

I find it strange that “IPv6 address” isn’t an identifier.
Shouldn’t they change that?

Maybe they do when IPV6 will be really established