RE: VBA code to read weather
- From: dymondjack <dymondjack at hot mail dot com>
- Date: Mon, 2 Mar 2009 17:07:01 -0800
This one has really sparked my curiousity. As an aspiring pilot, I've lately
been considering an application to handle some of the more common functions
related to aviation (not that there isn't umpteen sources for this already,
but...). Adding a weather moniter into the app would be quite convenient
indeed.
Upon writing my previous post, I checked wunderground to see if the actual
data was available through the source code, and was suprised to find that it
was. Good news. The next question is: can we reliably count on this
information being in the same structure every time? I think so... but we'll
have to make sure. Depending on the weather, a site may have more content on
certain days/times than others, so we'll need to make sure that, in the event
of added content (advisories, etc) that may not be be there on a more normal
basis.
I *think* the structure of the source should not change, but to verify, we
can save copies of different instances of the source in various states of the
site display, and run some comparison utility such as WinDiff to compare the
files and see where the changes might be. This might take a while to make
sure it's downpat, but shouldn't be impossible.
The next big question (the one I don't have any ideas on yet), would be how
to programmatically get a copy of that source code via access (I'm assuming
we'll use some scripting, I don't believe vba has this type of functionality,
but luckily vba can execute the scripts).
So I think the steps would resemble something along the lines of:
1) Open the webpage (easily enough accomplished)
2) Save the webpage to disk for offline use, or
Access the Source Code and save that to disk
#2 is the problem area. If the webpage can be saved for offline use, a copy
of the source is then available from disk. But I'm not sure how to
accomplish this. Possibly some cmdline arguments for IE??
Can anyone supply any feedback on how to accomplish this? I'll search
around some (starting with IE cmds, if possible).
I do wonder about legal implications... I always wondered why the source
code for any website you visit is available to anyone that knows how to find
it. I figured it would be more protected. I'll have to do a bit of research
on this as well.
--
Jack Leach
www.tristatemachine.com
- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain
"dymondjack" wrote:
good luck with that one....
Unless some weather software has designed an application to integrate with
access, this probably isn't the easiest task. I have never heard of anything
of the sort, but I guess that doesn't mean it doesn't exist.
If this was a project I had to take on, I would start by looking at a
weather provider's website (weather.com, wunderground, etc) and scanning the
source code of the website. If, by chance, the details of the website are
available through the source code, and not called by functions (the
temp/winds (etc) values would have to be part of the source), you might at
that point be able to get access to save a copy of the page, open it as a
text file, and read through the html and pull the appropriate values. Maybe
some sort of parser can help with that. It would require you to know the
bulk of the website's source code structure, taking into account any changes
that might be made to show different media in the website.
Sounds like fun.
BTW, www.wunderground.com has source code available, and the values are
accessable through the source.
good luck
--
Jack Leach
www.tristatemachine.com
- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain
"HGJ" wrote:
I am looking for a sample VBA code to read current weather for Ontario from
Canada weather network and display or update the weather table
Thanks
HGJ
- Follow-Ups:
- Re: VBA code to read weather
- From: Stuart McCall
- Re: VBA code to read weather
- References:
- VBA code to read weather
- From: HGJ
- RE: VBA code to read weather
- From: dymondjack
- VBA code to read weather
- Prev by Date: Re: Problem with email when moving application from desktop to Citrix
- Next by Date: Re: VBA code to read weather
- Previous by thread: RE: VBA code to read weather
- Next by thread: Re: VBA code to read weather
- Index(es):
Relevant Pages
|