Make Your Pc Talk Weather Data To You_llAlright, today we’re taking another look at how to make your computer talk. This time we will use our VB script to let our PC read out some useful data

NOTE: If you missed part 1, click here

Click here to join Ultra.io - Rare NFTs and Play-to-Earn Games or Read my review first!

Parsing Data: Few Reliable Sources

The problem with parsing data is that there are few public domain sources that allow you to scrape weather data and other things. If you’re located in the US, you’re in luck, because you won’t have any problems finding the 4-letter ICAO station on NOAA. But even if you’re not in the US, NOAA provides weather data for most major cities around the globe, but it requires more work and string manipulation. In Part 3 we will also provide a solution for Non-US cities

Computer Speaking To You: Tells You Current Date and Weather in Major US Cities

1. Step If you missed the previous tutorial you have to follow this one first or you won’t know what I’m talking about

2. Step Next, we are going to download AutoHotkey from http://www.autohotkey.com/ and Notepad++ from http://notepad-plus-plus.org/

3. Step After installing Autohotkey and Notepad++, download this file

4. Step Right-click on noa.ahk and click on edit with Notepad++. Now replace the Airport_Code = PHX with your US airport code.

 

Xml Feeds Of Current Weather Conditions

 

Important: Right now this script will only work for US weather stations. Simply copy the 4-letter ICAO station identifier from http://www.weather.gov/xml/current_obs/ – go to the site, select your state from the dropdown field and click Find, then copy the 4 letter code in brackets.

If you are outside the US you will have to do a lot more coding, testing and what not. NOAA provides data for major cities outside the US! The problem, they are usually using METARS data which you have to parse using Autohotkey (http://aviationweather.gov/adds/metars/)

Computer Still Talking? Test It

Let’s see if our VB script will still work when we add our new text file

0. Copy the noa.ahk to your test folder and double-click the file

1. Step Open your runner.bat file with a notepad editor

2. Step Next, change mytextfile.txt to a fully-qualified path that points directly to the file we just created. Example: C:\snippets\speak.vbs C:\Users\sOliver\Documents\PHX_Data.txt

  • Keep in mind, PHX_Data.txt will be called differently depending on the weather station code you used in step 4 (above)

3. Step When you double-click the runner.bat (should be on your QuickLaunch toolbar too) then it should talk to you and and tell you something like Hello - it is currently 16:09 and the temperature is 49.0 degree Fahrenheit

Schedule Autohotkey File

1. Step You can either create an infinite loop in Autohotkey or use the Windows 7 task scheduler to run the AHK file occassionally to get the latest weather and date. An infinite loop often breaks and uses too much memory, we therefore recommend to use the task scheduler

2. Step Follow our guide how to schedule a Powershell script
Schedule Powershell script via task scheduler

3. Step You now know how to schedule a script – simply schedule the noa.ahk file to run every X minutes or X hours and it will automatically update the .TXT file with more recent weather data

Alright, that’s it – if you’re outside the US and don’t want to wait for the next update, I recommend to look up the regular expressions functions that Autohotkey uses and how to use them to manipulate the METARS data from http://weather.noaa.gov/pub/data/observations/metar/stations/