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:
run firefox (the first tab in firefox is a URL that gets the current ip address
pauses for 60 seconds to allow firefox to run and get the url
takes a screen shot that is saved on the desktop
pauses for 15 seconds
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.
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.
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.
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.
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...
Another option that would drop the requirement for logging IPs would be to set up a zerotier network. It's a bit like a VPN, end-to-end encrypted, and is easier to set up than it would appear.
Basically you run the zerotier client on yours and your Mom's computers, you create a free zerotier account and using their web interface you create and name a zerotier network. Then you use the 16-digit network ID displayed on the web ui and join that network from the zerotier clients on yours and your Mom's (and up to 98 other computers). You can then enable or disable that network at will from the zerotier icon in your menubar.
The result is that you're both assigned IP addresses on that zerotier network, and you'll both be on the same virtual LAN -- it'll feel as if your computer's are on the same local network. Multicast and broadcast work over zerotier by default, so you'd see your Mom's computer in the 'Network' section of a Finder window and could choose to establish a screen sharing or file sharing connection right then and there. You'd never again need to know the IP address her internet provider has assigned her.
Whilst I am surprised that you have resurrected and old thread,
I am very grateful as Zerotier looks really interesting.
Zerotier appears to be very simple but an extremely neat solution.