This script used to work on an older version of AutoIT. Currently I am running AutoIT v3.3.14.5 and it's failing.
Func PublicIP() ;Post public facing IP address
Local $url = 'https://www.google.com/search?client=opera&q=what+is+my+ip&sourceid=opera&ie=UTF-8&oe=UTF-8'
Local $getIPaddress = BinaryToString(InetRead($url))
Local $sStart = 'clamp:2">'
Local $sEnd = '</div>'
Local $ipaddress = _StringBetween($getIPaddress, $sStart, $sEnd
For $i In $ipaddress
MsgBox(0, 'External IP', "Your public IP address is " & $i)
Next
EndFunc ;==>PublicIP
The console output shows:
"C:\Users\user\Documents\AutoIT\Scripts\WSI Tools.au3" (197) : ==> Variable must be of type "Object".:
For $i In $ipaddress
For $i In $ipaddress^ ERROR
->14:12:16 AutoIt3.exe ended.rc:1
+>14:12:16 AutoIt3Wrapper Finished.
>Exit code: 1 Time: 9.811