Hey there Guys and Gals! I recently uploaded a set of gadgets that were malfunctioning. The weather gadget would keep reverting to my location, instead of staying on the user's location. I believe it is because the gadget being that, a gadget rather than a widget, sees my location as default. I hope I am being clear. They work correctly as widgets, somehow, my location seems to become FINAL, for lack of a better term, when I export it as a gadget. When the user puts in his/her info, all is well. It reverts to Greeneville,Tn. upon restarting of the gadget, or rebooting the computer. Long story short, I am looking for anyone who knows script who can help me with this. I would like to send out some gadgets so that they could be used by people who don't have DesktopX. Any help would be greatly appreciated. The script I used is by Martin. My widgets can be found at http://chubbyhusband.wincustomize.com Please send any information that might help. I will post the script below.
Sub Object_OnStateChange(state)
If state = "Command executed" Then
x = DesktopX.ScriptObject("weather_image").Object.PersistStorage("zipcode")
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://xoap.weather.com/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").Object.PersistStorage("zipcode") = x
DesktopX.ScriptObject("weather_image").Object.PersistStorage("zipcode2") = "20659"
DesktopX.ScriptObject("zip2").Object.text = DesktopX.ScriptObject("weather_image").Object.PersistStorage("zipcode2")
DesktopX.ScriptObject("weather_image").Object_OnTimer6001
End If
If Msgbox("Would you like to add a second Zone?", vbYesNo,"Second Zone Input") = vbYes Then
y = DesktopX.ScriptObject("weather_image").Object.PersistStorage("zipcode2")
If IsNumeric(x) = False Then y = Object.Text
y = InputBox("Please enter a Second zip code or location that you would like to display the weather for:" & vbNewLine & "e.g. 48152 or York,England", "Select location ...", y)
If IsNumeric(y) = False Then
Set http = CreateObject("Microsoft.XmlHttp")
Randomize
str_RANDOM_URL="&rnd=" & rnd()
http.Open "GET", "http://xoap.weather.com/search/search?where=" & y, 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)
y = weatherdata
End If
End If
If y <> "" Then
DesktopX.ScriptObject("weather_image").Object.PersistStorage("zipcode2") = y
DesktopX.ScriptObject("zip2").Object.text = DesktopX.ScriptObject("weather_image").Object.PersistStorage("zipcode2")
DesktopX.ScriptObject("weather_image").Object_OnTimer6001
End If
End If
End If
End Sub