This is homeseer script written in VB Script that parses the environment canada webpa
'* Purpose: This script extracts the weather for a Canadian location from Environment
'* Canada's webpage and formats it for display on a users Homeseer webpage.
'* It displays the following information on the Homeseer webpage:
'*
'* Time conditions were observed on by Env. Canada (in UTC format, old GMT)
'* Current weather condition with the appropriate icon displayed
'* Current Temperature, Pressure, Visibility, Humidity
'* Current wind direction and speed with direction icon
'* Current windchill, dewpoint or humidex depending on conditions (variable)
'* Normal High, Low and Mean temperatures for that day
'* Yesterday's High, Low and Precipitation
'* Five day weather forecast including today in text and/or graphical format(s)
'* Weather warning status
'* Sends email(s) when weather warning first detected
'*
'* Temperatures are displayed in a variable colour to highlight them. Colour
'* ranges from Dark blue for coldest to Dark Red for Warmest. See "Colourize
'* Temperature" function for more info.
'*
'* Weather warnings are displayed in purple if they are active for your location.
'* Depending on your browser the weather warning will scroll (IE) or flash (NS).
'*
'* Wind directions are expanded from their acronyms (N, NE, NNE etc.) provided
'* on the Env. Canada webpage into their full length names (North, North East,
'* North North East etc.). See Expand_Wind_Direction function.
'*
'* Links are provided to the Locations's Env. Canada website for the weather and
'* trends via clicking on the current weather and [temp, humidity, wind, variable]
'* icons respectively.
'*
'* USER CONFIGURATION STEPS:
'*
'* Place Canada_Weather.txt in Homeseer scripts directory and all images in either
'* \html\envcanadaicons or \html\envcanadaicons\temp directories (look at zip paths
'* to see which are which) under Homeseer directory (zip includes default file
'* locations).
'*
'* Your location must be supported by Env. Canada. Start here to determine your
'* locations info: http://weatheroffice.ec.gc.ca/canada_e.html. When you get to
'* the webpage for your location record the last x characters of the URL. For
'* example Calgary's location webpage is:
'*
'* http://weatheroffice.ec.gc.ca/city/pages/ab-52_metric_e.html
'*
'* LOCATION
'* Name of place to be spoken and displayed by Homeseer (need not match Env
'* Canada webpage, ex: "Calgary").
'*
'* LOCATION CODE
'* last x chars. of URL (for Calgary example above would be "ab-52_metric_e.html")
'*
'* FORECAST START STRING TAG
'* This tells the script what string on the webpage delineates the start of the
'* locations weather forecast. Look at the line below the "Text Forecast" heading
'* and copy from the start of the line up to and including the colon. For the
'* Calgary webpage example, the tag is "Calgary:".
'*
'* TIMEZONE
'* Timezone of your location. Must be one of: PDT, MDT, CST, CDT, EDT, ADT, NDT.
'* Can be seen in "Observed on:" string e.g. "16 Sep. 2003 at 10:00 PM CDT".
'* Do not forget to adjust for DayLight Savings time though.
'*
'* Examples for the above 3 user configuration constants are provided below.
'*
'* The script uses 18 virtual devices to store the weather info for display. The
'* user must create these in Homeseer and enter them in the config. section below.
'* The default is w1 to w18.
'*
'* GRAPHIC_FORECAST_UNITS
'* Determines whether the graphical forecast is displayed with Metric or Imperial units.
'* For imperial units set to "I", for metric, to "M".
'*
'* SPEAK
'* If the user wishes to have the script speak the weather every time it runs, set
'* this value to TRUE otherwise leave it as FALSE.
'*
'* DEBUG
'* This causes copious debugging information to be placed in the Homeseer log every time
'* the script runs. It generates lots of info so unless you are having problems,
'* leave it as FALSE.
'*
'* DISPLAY_ICONS
'* This causes the display of icons if enabled, otherwise none are shown.
'*
'* BORDER
'* This determines whether an icon will have a border (>0) or not (=0). Bigger number
'* gives a thicker border.
'*
'* HIGHLIGHT_PREFIX_START and _END
'* This is used to highlight the weather warning display. Internet Explorer works
'* with while Netscape users should use instead.
'*
'* DISPLAY_TEXT_FORECAST and DISPLAY_GRAPHIC FORECAST
'* These determine whether the respective devices are displayed on the HS web page.
'*
'* SEND_EMAIL_FOR_WARNING
'* If this is set to true an email is sent when a weather warning is first detected.
'*
'* TO_EMAIL, FROM_EMAIL and WARNING_EMAIL_SUBJECT
'* These are used when a weather warning is first detected. An email will be sent
'* to the TO_EMAIL list from the FROM_EMAIL address with the WARNING_EMAIL_SUBJECT.
'*
'* YAC_ENABLED
'*
'* This is uesed to determine whether or not to use the YAC program to send out a
'* message to all YAC clients on the home network. You can get YAC here:
'*
'* http://sunflowerhead.com/software/yac/
'*
'* Get the command line YAC exe here (make sure its on your path):
'*
'* http://sunflowerhead.com/software/yac/YACTextSend.zip
'*
'* I also use YAC to send out caller ID messages etc. Highly recommended and free!
'*
'* Finally, the user must add a recurring event to call this script at a certain
'* frequency. I run mine every 15 minutes.
'*
'* USAGE FROM EXTERNAL SCRIPTS:
'*
'* All weather variables are stored as Global Vars. They are referenced by the
'* weather house code (default "w") and units 1 - 18. Individual "Speak_"
'* subroutines are provided to speak every weather variable (normals and yesterday
'* are gouped in 1 subroutine each). For example lets say you want an event to
'* speak just the Forecast, the following script would suffice:
'*
'* #include Canada_Weather.txt
'*
'* Sub Main()
'*
'* Call Speak_Forecast()
'*
'* End Sub
'*
'* If you have trouble with the above method you can also try:
'* Sub Main()
'*
'* hs.runex "Canada_Weather.txt", "Speak_Forecast", ""
'*
'* End Sub
'*
'* Available routines are: Speak_Current_Weather
'* Speak_Temperature
'* Speak_Pressure
'* Speak_Wind
'* Speak_Humidity
'* Speak_Visibility
'* Speak_Variable
'* Speak_Normals
'* Speak_Yesterday
'* Speak_Forecast
'* Speak_Warning
'* Speak_All
'*
'* Speak_Variable speaks either the Windchill, Dewpoint or Humidex depending on
'* which is available.
'*
'* ERROR HANDLING:
'*
'* This script has a built in error handler that will write to the homeseer log.
'* If you cannot deduce the problem from this info. set DEBUG to TRUE for more help.
'* Save the homeseer log to a text file so you can view the web page contents. If that
'* still doesn't help post problem to:
'*
'* http://board.homeseer.com/showthread.php?t=95595&highlight=canadian+weather
'*
'* ** Important** If you change the script make sure you comment out the indicated
'* handler sections in main() otherwise you won't get line number if you make a mistake.
'*
'* Note: This script was my first and borrows from great work by DSTEINEURO and
'* many other Homeseer script contributors. Kudos to Keware for making the best SW
'* product I've ever purchased! Updates will be reported at the above link.
NOTE: Thanks to Steven Karl for modifying it last to account for Environment Canada's last website changes.
|

| Rating |
 |
| Popularity |
 |
| Downloads |
9 |
| Page views |
3336 |
|