My mother's ip address


#1

My 94 year old mother has a 27" imac in her room and lives 200 miles from me. I facetime with her every day and for the past year or so I log onto her computer remotely using Apple Remote Desktop) and answer my own facetime call so that we can talk and see each other.

The only problem is that whenever there is a power failure or her computer restarts the ip address changes and I can no longer log on remotely. Up until a few months ago, I could phone her and walk her through the process to give me the new ip address. Lately this has not worked as well due to her age.

Today I used Keyboard Maestro to do the following (see attached). Whenever the computer restarts (and I have set it to start up every day at 5 am) an apple script application runs that uses the Keyboard Maestro file to:

  1. run firefox (the first tab in firefox is a URL that gets the current ip address
  2. pauses for 60 seconds to allow firefox to run and get the url
  3. takes a screen shot that is saved on the desktop
  4. pauses for 15 seconds
  5. moves the screen shot to a dropbox folder on her computer that is shared with me.

I can then open my dropbox folder and get the new ip address.

Thanks Keyboard Maestro.


#2

Hey Terry,

That's an excellent idea!

You could simplify it quite a bit though.

-Chris


Save Public IP Address to Dropbox.kmmacros (1.7 KB)


#3

Thanks Chris. This is a little over my head but I will play with it a bit tomorrow. I do not understand what the script does


#4

Hey Terry,

It directly saves the public IP address to a dated file in Dropbox and avoids having to monkey around with browsers and screenshots.

This will create a new dated file every time it runs, but you could create 1 file and append to it.

-Chris


#5

By the way most routers would let you nail in place specific devices’ IP addresses. What I’m not sure about is whether that would be visible externally.

Just a thought.


#6

Some years ago I’ve written an AppleScript to constantly log the external IP address.

It appends the result to a log file, like this:

  • It creates a new entry only when the IP Address has changed
  • It is querying different fallback servers when the first one fails to reply (opendns.com, ip-addr.es, ifconfig.me, dyndns.org)
  • It displays a notification
  • It comes with a plist and instructions how to schedule it via launchd (but could also be used with KM)

You can get it here:


#7

When I.P. Changes from yesterday it will Text me and save to log... :slight_smile:

This script works good for me...
If you would like the source please just ask...

Regards,
Bill


#8

Hey Bill,

Well done.  :smile:

You can simplify a bit by changing the Execute an AppleScript action to an Execute a Shell Script action.

As far as I can see the initial curl command is all you need, because it always produces a plain IP-address (at least in my testing).

curl -s http://icanhazip.com

If you do need to filter out just non-digit and non-. characters then it’s simpler to use negation.

The caret character ^ when used at the beginning of a range [^…] means NOT.

curl -s http://icanhazip.com | sed 's/[^0-9.]//g'

And by piping the curl result directly to sed you can avoid messing about with temp files on-disk.

NOTE — in your AppleScript the delay command is unnecessary, because execution of the script waits until the result is returned from the do shell script command before moving on to the next statement.

-Chris


#9

Thank you VERY much Chis. I have duplicated what you have suggested and set it up on my mother’s iMac to save her IP Address every 6 hours into a shared folder in her dropbox. I also created an apple script application that will run whenever her computer reboots. This will also save the IP Address into the dropbox folder.

This is very neat and it will encourage me to play with KM more.


#10

Whilst I know this is a KM site, sometimes a screw is a screw, and a hammer won't work...

In view of that, wouldn't an easier option be to set up a DynDNS client on her PC and use the DNS name instead?

No-IP for instance has free accounts for up to 3 DNS names, with a few other restrictions, the worst of which is the requirement to confirm the account every 30 days...


#11

Hi everyone, Thanks for share this excellent* idea!