Hi Jim,
It seems to me that this is one of the first Functions created by Martin many years ago... This function requires an unambiguous spelling of City Name. That is, you must enter “New York, NY” to receive the correct data. Otherwise, if you just enter "New York", you will see 10 different places around the World... I don’t like this...
Naturally, my previous advice was incorrect, because it implied a different method to receive the weather data. So your fix here:
You need change the string:
"http://xml.weather.com/search/search?where=" & x, False
to:
"http://wxdata.weather.com/wxdata/search/search?where=" & x, False
So the working function should be:
Function Object_OnLButtonUp(x,y,dragged)
If dragged = False Then
x = DesktopX.ScriptObject("weather_image").location
If IsNumeric(x) = False Then x = Object.Text
x = InputBox("Please enter the zip code or location that you would like to display the weather for:" & vbNewLine & "e.g. 48152 or York,England", "Select location ...", x)
If IsNumeric(x) = False Then
Set http = CreateObject("Microsoft.XmlHttp")
Randomize
str_RANDOM_URL="&rnd=" & rnd()
http.Open "GET", "http://wxdata.weather.com/wxdata/search/search?where=" & x, False
http.send ""
' Store data in a string
weatherdata = http.responseText
If InStr(weatherdata, "loc id") > 0 Then
weatherdata = Right(weatherdata, Len(weatherdata) - InStr(weatherdata, "loc id") - 7)
weatherdata = Left(weatherdata, InStr(weatherdata, "type") - 3)
x = weatherdata
End If
End If
If x <> "" Then
DesktopX.ScriptObject("weather_image").location = x
DesktopX.ScriptObject("weather_image").Object_OnTimer6001
End If
End If
End Function
By the way, you can easily check how this works before applying the fix to your code. Just open a new tab in your browser and paste something like this to the address field:
http://wxdata.weather.com/wxdata/search/search?where=New York, NY
Then press Enter and you will see the result.
Have a nice Day!
P.S. If your widget still does not work, change the URL inside the
DesktopX.ScriptObject ("weather_image")
to one of my previous post. I think you will find the right place here:
Sub Object_OnTimer6001.