3

Is there a way I could use AppleScript to check for my network ip address? Or an alternative coding option? I need to save the ip address to a file if it has changed and then upload it to my ftp server with a date and time stamp. I have this part figured out its just checking for the address.

Parag Bafna
  • 22,812
  • 8
  • 71
  • 144
Isaiah Turner
  • 2,574
  • 1
  • 22
  • 35

2 Answers2

2

ifconfig.me just returns a plain text public IP:

do shell script "curl ifconfig.me > ip.txt"
Lri
  • 26,768
  • 8
  • 84
  • 82
0

Try:

set filePath to POSIX path of ((path to desktop as text) & "myIp.txt")
set myIp to do shell script "curl checkip.dyndns.org | grep -Eo [0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+ > " & quoted form of filePath
adayzdone
  • 11,120
  • 2
  • 20
  • 37