- Create a new text file called MyUberLeetSVCFile.svc.
- Add a title comment. Something like
# Fred's Weather Service, http://weather.fred.com/
is appropriate. [Add comment lines throughout the file, by the way!]
- The file must contain two lines like
f_url: http://weather.fred.com/whatever/%STATION%_f.html
for imperial measurements, and
c_url: http://weather.fred.com/whatever/%STATION%_c.html
for metric measurements. [Note: perhaps not all weather services do it this way, but the option is there. If not, just use the same URL both times.] Anyway, if these lines are omitted, BBWeather won't work properly.
- The rest of the lines in the file define tokens and snippets. A token is defined using
TOKEN.start: "start snippet"
TOKEN.end: "end snippet"
Each token must have one start and one end entry, otherwise you'll get a BAD error.
- The start snippet must be unique in the data file. The end snippet doesn't have to be unique. Whatever comes between these two snippets in the data file is taken as the datum to replace the corresponding token in the format string [as defined in the BBWeather.rc file]. For example, suppose the format string is
Temp: $TEMP$, Wind Speed: $WSPD$
and Whatever.svc contains
TEMP.start: "Temperature: "
TEMP.end: "<br>"
WSPD.start: "Wind Speed: "
WSPD.end: "<br>"
and the data file looks like
Temperature: 30 degrees C<br>Wind Speed: 10 knots<br>
then the BBWeather window will display
Temp: 30 degrees C, Wind Speed: 10 knots
Simple, eh?
- When looking for a start snippet in the data file, ignore newline characters and quote marks ["]. They are automagically stripped out of the downloaded file.
- Always include a comment before each token definition, so we know which token does what!
- Note that you don't have to use HTML weather services, or even weather services come to that. [You could display the football results, or the latest headlines.] Anything can be displayed, be it HTML, XML, CSV, C++ code or RSS newsfeed, as long as it's updated regularly. [Wouldn't be much point otherwise, would there? :)] Oh, and as long as you can find unique snippets for each token.
- Send me your completed SVC file! [Please, so I can post it for everyone to enjoy.]
- Sit back and bask in the glory and gratitude of millions of BB users. :P