QA Graphic

Getting Your IP Address

Create a TextExpander snippet to get you IP address on demand.

As an engineer, you may need to know what your current IP address is. You may need this for various config settings or to let the IT team know.

So, why not spend a few minutes today and set up a couple of TextExpander snippets so that you can easily get your IP address whenever you need it. It's pretty easy to setup.

External IP Address

This will show you the external IP address that the world sees. Thanks for applewriter.com for the fundamentals of getting the data.

Applescript External IP

Sample Code:

(*
Credit to www.applehelpwriter.com
*)
set myTemp to do shell script "mktemp -t txt"
do shell script "curl -s http://checkip.dyndns.org &> " & myTemp & " &2> /dev/null"
# CHANGE THE DELAY HERE...             
delay 3
set extIP to do shell script "sed 's/[a-zA-Z/<> :]//g' " & myTemp

Internal IP Address

This is you Internal IP that could be automatically generated from you internal router. Some machines might be configured to always use the same IP address.

Internal I P

Sample Code:

set tIP to do shell script "ifconfig en0|grep 'inet '|cut -d ' ' -f 2"

  Filed under the TextExpander category. - Permalink

About

I find TextExpander, by Smile on My Mac, to be an awesome productivity tool. This past winter, I posted some cool snippets that demonstrate the power of the application. Occasionally, I will post some new snippets that I think will be useful in anyone's TextExpander library.