Help! Weather System?
RomanDA Need a little help?
Tuesday, May 19, 2009 by Automan | Discussion: DesktopX Tutorials
Hey;
Hope everyone is doing great!!!
I posted a link to an image of my 5 Day forcast and the way it's layout is. Image Below:
Hey RomanDA ; I there guy we have typed in the past a lot on mods for Desktopx. Where you at on this one buddy?
I want to use the Weather XML but I don't or haven't had the time to look into all of the weather widgets for DesktopX and also the Objects for Forcasting in DesktopX.
I am trying to make my DesktopX Weather come out the same as i the screenshot link and can't seem to get the images to show or get it with in the same layout.
I always keep it on and it checks the weather XML every 30 mins. I am using Samurize to don this as the program had a Weather 2004.dll that makes it wasy to set-Up the 5Day forcast.
So can some one give me some help on the switch to DesktopX. When the Prometheus Dark DesktopX Pro Theme comes out I will give all of the weather related accomplishment CREDITS to who ever might help on this.
I hope some one can help as I don't want to pick someone elses weather Object or Widget apart and make it work with this theme.
Thanks
Automan
Reply #2 Monday, June 1, 2009 11:30 AM
Hi RomanDA;
I am trying to get help on building a weaher 5Day that will pull the XML file and save it to a Directory like my temp dir., then there is a section of the XML file that is advertizing from Weather.com, this XML area screws up the XML file so I have to get this build to either strip the section out of the XML file then read it after the fix.
I can look at the 5Day section of one of the widgets but the XML problem is still there.
Now if the reading of the XML file will over look the Advertizing section and pull the 1st dat Now and Later then it's a go.
I just can't seem to be able to get around the section I am refering to.
Any ideas on that?
that there guy for the reply, I would like to quit using the Samurize program all together and just use DesktopX for all of my weather.
Also take a look at my next post, there is something wrong with using the Internet ActiveX control thats with DesktopX that is showing a Border on the Right and Bottom of the Web Control item. I called Microsoft and they mentioned that DesktopX needs to be changed to handle this. So I am going to leave a message for the Support team to get them to take a look at this.
Thanks
Automan
Reply #3 Monday, June 1, 2009 12:45 PM
What XML file are you using? Where from? I think you should be able to parse out the unwanted info and then rewrite the file.
Reply #4 Monday, June 1, 2009 1:07 PM
This is just a quickie file parser code. It'll retrieve the unwanted section, erase it, and rewrite the file.
Just put in your file path and section tags. You might want to test this on another xml file first, before you rewrite your actual xml file...just to see if it works.
- Dim xmlfile
- xmlfile = object.Directory & "hi.xml" '--YOUR XML FILE HERE
- 'Called when the script is executed
- Sub Object_OnScriptEnter
- getcontent = readFile '--get xml contents
- parsecontent = extractInfo(getcontent,"<to>","</to>"&vbcrlf) '--retrieve unwanted section
- getcontent = replace(getcontent,parsecontent,"") '--erase unwanted section
- writefile(getcontent)'--rewrite file
- End Sub
- 'Declare constants
- Const ForReading = 1, ForWriting = 2, ForAppending = 8
- 'Declare the file system object
- Dim fso, f, Msg
- Set fso = CreateObject("Scripting.FileSystemObject")
- Function readFile
- 'Check if file exists
- If fso.FileExists(xmlfile) Then
- Set f = fso.OpenTextfile(xmlfile, ForReading)
- fileinfo = f.readall
- f.Close
- Else
- msgbox "File does not exist"
- End If
- readFile = fileinfo
- End Function
- Sub writeFile(newcontent)
- 'Create a file and write some text
- Set f = fso.OpenTextfile(xmlfile, ForWriting, True)
- f.Write newcontent
- 'Properly close file
- f.Close
- End Sub
- Function extractInfo(info, startStr, endStr)
- iStart = instr(1, info, startStr)
- iEnd = instr(iStart, info, endStr)
- iEnd = iEnd + Len(endStr) '--include closing tag
- iLength = iEnd - iStart
- info2 = mid(info, iStart, iLength)
- extractInfo = info2
- End Function
Reply #5 Thursday, June 4, 2009 10:52 AM
Hi sViz;
Good to see you! Long time...
OK to the code andentered the correct directy and file nam to the section you pointed at and the code is as fillows.
1.Dim xmlfile
2.xmlfile = object.Directory & "C:\Users\Automan\AppData\Local\Temp\Weather.2004\Weather.Forecast.37932.English.5.Days.xml" '--YOUR XML FILE HERE
3.'Called when the script is executed
4.Sub Object_OnScriptEnter
5. getcontent = readFile '--get xml contents
6. parsecontent = extractInfo(getcontent,"<to>","</to>"&vbcrlf) '--retrieve unwanted section
7. getcontent = replace(getcontent,parsecontent,"") '--erase unwanted section
8. writefile(getcontent)'--rewrite file
9.End Sub
10.
11.'Declare constants
12.Const ForReading = 1, ForWriting = 2, ForAppending = 8
13.'Declare the file system object
14.Dim fso, f, Msg
15.Set fso = CreateObject("Scripting.FileSystemObject")
16.Function readFile
17. 'Check if file exists
18. If fso.FileExists(xmlfile) Then
19. Set f = fso.OpenTextfile(xmlfile, ForReading)
20. fileinfo = f.readall
21. f.Close
22. Else
23. msgbox "File does not exist"
24. End If
25. readFile = fileinfo
26.End Function
27.Sub writeFile(newcontent)
28. 'Create a file and write some text
29. Set f = fso.OpenTextfile(xmlfile, ForWriting, True)
30. f.Write newcontent
31. 'Properly close file
32. f.Close
33.End Sub
34.Function extractInfo(info, startStr, endStr)
35. iStart = instr(1, info, startStr)
36. iEnd = instr(iStart, info, endStr)
37. iEnd = iEnd + Len(endStr) '--include closing tag
38. iLength = iEnd - iStart
39. info2 = mid(info, iStart, iLength)
40. extractInfo = info2
41.End Function
Now when I try to save and apply the code I get an immediate errow on line 1--->
Expected statement
Line: 1
Code:
1.Dim xmlfile
Thats it.
Question? Is there a way to get code for an XML weather formation like the picture I have and just use DESKtopX to retreve the Weather data to a directory os choice then strip the bad stuff " Advertizing ", then set where the 42x42 Weather Images are at. the layout all the fields the same as the Samurize config, and just drop Samurize altogether and have the weather running with in the DesktopX Theme I have.
Reason for using only desktopX for the Weather XML and images and info placeed into the same position as I have in the image is that I want the weather to be DesktopX run Weather altogether so that I can release this theme and get permissions and give credits, ets,
This Desktop is aone of a kind not produces or even close to all the DesktopX themes I have seen, this is a real life desktop that have running weather radar using two or three HTML page whice I will make available, with docs.
Take a look at this screen shot and you wisee what I mean:
https://www.wincustomize.com/skins.aspx?skinid=24755&libid=13
The Today Weather at the top I can get working, if i have a script to get going on the 5Day with. I just create two objects and place the weather script to them and presto they are all done withDesktopX and not using another program.
But I do think you are very close in you code to picking out the downloaded XML file and getting rid of the AD section. That wat if Weather.com changes again it's just a matter of stripping some more of the downloaded file again.
Thanks a Million, I willl try the code again after ya tell me what I probable did wrong on the script you wrote, just to pre check it.
Automan
Reply #6 Thursday, June 4, 2009 2:56 PM
You have to take out the numbers (1. 2. 3. etc) that get copied with the script. Don't know why the forums copy numbers with the script; kinda defeats the purpose.
Don't forget to change the XML tags in this line to the ones you're stripping out:
parsecontent = extractInfo(getcontent,"<to>","</to>"&vbcrlf) '--retrieve unwanted section
Here's the code again without those numbers:
Dim xmlfile
xmlfile = object.Directory & "hi.xml" '--YOUR XML FILE HERE
'Called when the script is executed
Sub Object_OnScriptEnter
getcontent = readFile '--get xml contents
parsecontent = extractInfo(getcontent,"<to>","</to>"&vbcrlf) '--retrieve unwanted section
getcontent = replace(getcontent,parsecontent,"") '--erase unwanted section
writefile(getcontent)'--rewrite file
End Sub
'Declare constants
Const ForReading = 1, ForWriting = 2, ForAppending = 8
'Declare the file system object
Dim fso, f, Msg
Set fso = CreateObject("Scripting.FileSystemObject")
Function readFile
'Check if file exists
If fso.FileExists(xmlfile) Then
Set f = fso.OpenTextfile(xmlfile, ForReading)
fileinfo = f.readall
f.Close
Else
msgbox "File does not exist"
End If
readFile = fileinfo
End Function
Sub writeFile(newcontent)
'Create a file and write some text
Set f = fso.OpenTextfile(xmlfile, ForWriting, True)
f.Write newcontent
'Properly close file
f.Close
End Sub
Function extractInfo(info, startStr, endStr)
iStart = instr(1, info, startStr)
iEnd = instr(iStart, info, endStr)
iEnd = iEnd + Len(endStr) '--include closing tag
iLength = iEnd - iStart
info2 = mid(info, iStart, iLength)
extractInfo = info2
End Function
I'm inclined to say yes. If all the information present in the screenshot above is retreived from an XML file, you should be able to strip out the info you need and apply them to text objects or image objects. But without seeing the actual XML file you're using, I can only postulate on how to do that. If you can send or point me to an example XML file like the one you're using I might be able to tailor the code.
Here is the tutorial I read to get started on making rss readers -- LINK
Reply #7 Saturday, June 6, 2009 11:50 AM
Hi sViz;
OK Tried the new code and get an error with DesktopX " Line 7 ) needed"?
Here is the XML file I use:
This document is intended only for use by authorized licensees of The
--> Weather Channel. Unauthorized use is prohibited. Copyright 1995-2009,
--> The Weather Channel Interactive, Inc. All Rights Reserved.
-->
Reply #8 Saturday, June 6, 2009 12:59 PM
The Weather Channel Interactive, Inc. All Rights Reserved.
is it just me, or does the scare other people too?
Reply #9 Saturday, June 6, 2009 1:28 PM
This document is intended only for use by authorized licensees of The
The Weather Channel Interactive, Inc. All Rights Reserved.
is it just me, or does the scare other people too?
Uh, yeah. I don't see this kind of xml file anywhere for public download on weather.com. Automan, are you sure you're allowed to use this?
Reply #10 Saturday, June 6, 2009 2:01 PM
Hithere again:
I signed up for the Weather.com XML and lave a license code and aut. code.
I pull today.XML and I pull 5 Day..
No prob folks, it is best to get a free license from them justlook on their site for tools and on the left of the list on down a ways the is the Weather.com XLM feed sign up "FREE"
This is mine with license:
<?xml version="1.0" encoding="ISO-8859-1" ?>
This document is intended only for use by authorized licensees of The
-->
Weather Channel. Unauthorized use is prohibited. Copyright 1995-2009,
-->
The Weather Channel Interactive, Inc. All Rights Reserved.
-->
Automan
Reply #11 Saturday, June 6, 2009 2:45 PM
Hey Folks:
Thought that I would give you the link for the Weather.com XML FREE Feed after you sign up and remember FREE, Then down load the SDK. Forget some of the stuff like placing the Weather.cm Logo with your projects...
All of the folks out there that use the XML Feed should at least sign-up......Only right....
Link: http://www.weather.com/weather/rss/subscription?from=footer
Have fun.
Automan
Reply #12 Saturday, June 6, 2009 2:57 PM
Hi RomanDA;
I posted what ya need to feel safe using this and yes it it theirs, but you just sign up and ya have your on License and code. You woun't beleive the Weather Info you can get.
If you take a look at the post above a ways I have a link to my desktopX Theme.
Now here is the kick! Look at the middle top of the screen at the Today Weather and zero in on the Wind Direction and on the left of it the Brometer.
If someone can help me I can give all the in for and you woun't beleiv the widget you could build.
1. The XML file has to be downloaded every 30 minutes and not sooner.
2. You even then have mapping for raday and the best part WEATHER WARNINGS, whice a guy writting this for desktopX could use an all clea png and an animated warning right on your desktop when you are goiing to get slammed with bad weather.
3. It's all there for the taking, anyone in the ourld.....
We need to build code for this weather to hit all of the above, and then you have a REAL Weather Widget...Not just the Today and 5 Day forcast.
I always try to make it real and I sure would like to build allof what I have done in another program right into DesktopX with the person giving me the right to distribute the theme and to also give that person credit.
That should get some of those neurons jumping!!!
Take Care bud!!
Automan
Reply #13 Saturday, June 6, 2009 3:03 PM
Ah, ok.
Line 7 of the code looks like this:
parsecontent = extractInfo(getcontent,"<to>","</to>"&vbcrlf)
Yours should look like this:
parsecontent = extractInfo(getcontent,"<lnks type=","</lnks>"&vbcrlf)
Leave out the "prmo"> because that will cause the error you're referring to.
This should remove the ad section and rewrite the file without it.
Reply #14 Saturday, June 6, 2009 10:29 PM
Hi sViz;
Thanks for the shot, but I get a can't find file error now?
Any idea why that one happened?
I might have gotten lost the other post mentioned do a re-write of the section?
I took and copied the one you had as an example and pasted it over the same section iin the script I have for testing?
Thanks
Automan
Reply #15 Saturday, June 6, 2009 11:44 PM
What exactly did the error say? (copy & paste it here)
If it can't find the xml file then your xml file has been moved or otherwise gone missing. While testing, I usually use a spare xml file that I place on my desktop. That way I can easily check the file frequently to see if the operation worked, or if something went wrong. Make sure to check your xml file after each application of the script to see if the operation has already been successfully executed.
Reply #16 Sunday, June 7, 2009 9:50 AM
Hi sViz;
The error that comes up first is if you click the object you get this:
1. Normal Message box with OK button= The File Does not exist
Right after you hit OK button for the message bow error yu get a normal error from DesktopX with this:
Invalid procedure call or argument: 'instr'
Line: 42
Code:
(not available)
That all it does and I have checked the path,etc.
Thanks
Automan
Reply #17 Sunday, June 7, 2009 12:40 PM
Hi Again sViz:
Is there a possibility of pulling the information that is needed for the 5Day for cast and placing all of the images for the link to the weather icon number in like C:\localWeather\
Then just pull the fields and link the icon for that day to the images in the directory mentioned above, and just build this in DesktopX Pro to use DesktopX for the 5Day forcast.
I have shown that it is only illegal to use the XML download file if you have now signed up for it. I have and I can include instructions above in a post for all to see how to join and really be legal.
I sure would like to drop the other program and download the XML file to the Directory above But add a directory called XML and place the XML file into it every 35 minutes by a timer.
The way all of the other weather widgets get the weather may be the reason Weather.com gets pi***d?
Just a thought.
I only design with Photoshop CS4 and I am also an Engineer so I am just coming up with ideas on how this might work.
By the way " RomanDA ", I hope I have answered your concerns on how to get the real XML File from Weather.com.
There is also a great chance here to actually build a widget or object that has the borometer reading using a red arrow and also wind direction using a little math as to where the pointer should be compared to the info in the XML file and having this run real time.
I say COOL! Actually this would be one of the best 2 DesktopX weather systems built to date.
Thanks for the eye folks, I appreciate it.
Automan
Reply #18 Sunday, June 7, 2009 4:37 PM
Its fine.. i was just worred when i saw that. I have not played with weather xmls in forever, and i knew they were "cracking down" on people using the feeds.
Reply #19 Sunday, June 7, 2009 5:04 PM
I was just going over Martin's Base Weather widget, and realized your attempting the exact same thing--same website, same xml file, except without the advertisment.
I'd suggest downloading that and tailoring the script so it displays the information you want. He's also done a wind and UV meter (see above link.)
Reply #20 Tuesday, June 9, 2009 1:42 PM
Hi sViz and hello RomanDA!!!
OK I looked at the Weather script and sure enough I can place my download code into it and it gets the weather, but remember that I may have mentioned that I use a directory for the 42 pixel specially made for weather 5Day ad need to access those png files also if I use the script for the Todat weather that is in the Desktop image gallery I will also have to have a way to get to my 85 Pixel png files fopr the weather Icon.
This is why I am really wanting to take and re-write those scripts for all of this and then I can use the info I need and use my own png's for the weather and they would be located is "C:\Weather" Everything need to go either there or a directory in the themes folder in the DesktopX folder.
Either way, there is a real need to be able to use my on path to different Icons. I also noticed the some of the Select section has severa Icons listed if a certain condition exist, I can fix that by adding all of the crrect "Selects".
There are some really great Images "PNG's", out there that look 100% better than the ones in the script.
Any ideas, I do hate to be so picky about this but there is a need to up date a 2004 Weather script to make it work for every one in any fasion that they want.
Thanks folks, I really appreciate your help on this.
Automan
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!








Reply #1 Wednesday, May 20, 2009 12:41 PM
i believe there are a few weather widgets over in the widgets forum, and if you take some time and look them over you should be able to see how they work, or do like most people do, and take one and just move the images around, and put some new text on them.