Get approximate location from IP
Sat, 11/07/2020 - 08:09 am
This is a simple (Windows) function that returns the latitude and longitude determined from your IP address by looking up up at ipinfo.io.
Not as good as being able to use e.g. browser location data which is pretty accurate however I haven't figured how to do that in Igor, yet....
Should work in all versions of Igor that run on Windows for as far back as the ExecuteScriptText command goes. On Mac I'm sure there is an easy modification.
// funtion to get the approximate location of the computer from the IP address
Function [Variable latitude, Variable Longitude] getApproximateLocation()
ExecuteScriptText/B/Z "cmd.exe /C curl ipinfo.io" // ipinfo.io
LineStr = StringFromList(i,S_value, "\n")
sscanf lineStr, " \"loc\": \"%f,%f\",", latitude, longitude
while (i < ItemsInList(S_value, "\n"))
return [latitude, longitude]
Igor Pro 8
Igor XOP Toolkit
Igor NIDAQ Tools MX