Posted by: jeffengland | May 4, 2010

get Internal/External IP address

To communicate from the front desk module to the bowling lane, I needed to find out the lanes IP address. I created a applescript that finds out the clients local and external IP address and puts both values into a global field. Finding out the computers IP address is specifically important for solutions using remote triggering of scripts, in particular 360 works remoteScripter.

to getInOutIP()
set the_interface to 0
repeat
set ip_internal to “”
try
set ip_internal to do shell script (“ipconfig getifaddr en” & the_interface)
end try
if ip_internal is not “” then exit repeat
set the_interface to the_interface + 1
if the_interface = 5 then
set ip_internal to ” unknown “
exit repeat
end if
end repeat
try
set ip_external to word -7 of (do shell script “curl http://checkip.dyndns.org”)
if ip_external = “” then set ip_external to ” unknown “
on error
set ip_external to ” unknown “
end try
tell application “FileMaker Pro Advanced”
activate
set the contents of field “gIPaddress” of the current record to ip_internal & “_” & ip_external
end tell
return {Inside:ip_internal, Outside:ip_external}
end getInOutIP
set IPA to getInOutIP()
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.