Macro of the Day: Tell me the weather forecast for Redmond

Another good request for a macro came in the other day, this time from Brian (Thanks Brian). Here's what he wanted: A macro that can tell him the weather forecast.

Once you install this macro, you'll be able to say things like "What is the weather like in Redmond", or "Tell me the weather forecast for Redmond". It's only got a few cities in it right now, but you should be able to expand it to have as many cities as you care about.

Check it out here:

<?xml version="1.0" encoding="utf-8"?>

        <listenFor>what is the weather like in [CityName]</listenFor>
        <run command="{[CityName.zipCode]}"/>

        <listenFor>Tell me the weather forecast for [CityName]</listenFor>
        <script language="JScript">

            var xml_doc = new ActiveXObject("Microsoft.XMLDOM");
            xml_doc.async = false;

            var titles = xml_doc.getElementsByTagName("title");
            var descriptions = xml_doc.getElementsByTagName("description");

            Application.Speak(titles.item(2).text + " in {[*CityName]}");


    <listenForList name="CityName" propname="zipCode">
        <item propval="45255">Cincinnati</item>
        <item propval="98075">Sammamish</item>
        <item propval="98052">Redmond</item>
        <item propval="98004">Bellevue</item>
        <item propval="98101">Seattle</item>


Comments (6)
  1. bowser15 says:

    Hey Brian here,

    This is truly amazing!  Thank you for writing the macro for me!  I’ve been showing my friends what the WSR Marcros can do and they are extremely impressed.  Keep up the good work and thanks again!

  2. yokhannan says:

    This got me thinking, and granted I’m a newbie with WSR, but how about something like being able to pass a value to a search engine… sort of like this:



    <listenFor>search google [SearchValue]</listenFor>

    <run command="{[SearchValue]}"/>



    Is that doable? The example doesn’t work, just hoping you could share how to get that to work.


  3. Rob Chambers says:

    Yep. Totally doable. It looks like this:



       <listenFor>search google […]</listenFor>

       <run command="{[…]}"/>



    In this example, the macro system will listen for anything when it sees a listenFor that contains a […] reference. Then, in the run command, you can refer back to what was actually spoken with {[…]}.

    Cool, eh?

  4. yokhannan says:

    Dude, totally sweet!!

    I couldn’t figure out the .. part 🙁

    So thanks!!

  5. bowser15 says:

    The {[…]} part works but if say 3 words and then place them in google, the search string html is missing the "+’s" so instead you get three seperate google searches rather than one search with 3 words.  I’m trying to figure out how to fix this but don’t see how yet.

  6. a_chameleon says:

    I borrowed Rob’s temporary copy-to-clipboard / copy-back-from-clipboard [CDATA] to cure this, and for a few other reasons.

    I utter (below)  once the focus automatically enters the SearchValue field, at page load.


    listenFor>Insert [something]</listenFor>

    <script language="JScript">


       // Copy the selected text into the clipboard and wait 1/4 second

       Application.SendKeys("{250 WAIT}^c{250 WAIT}");      

       // Get the data out of the clipboard

       var text = Application.clipboardData.getData("text");



    I also use it because the wrong word string or phrase innocently dictated into the SearchValue box, can auto-fire a Google search for stuff you hadn’t finished saying, or non-related searches.

    The [CDATA] copy/paste, above, cures that, too.


    Further, if the user has the Google search bar installed, and/or has both Google & Live enabled in the browser’s native search box, uttering "Google Search" doesn’t necessarily click the [Google Search] button.

    Sometimes this phrase will give numbers to different instances of the word Google everywhere on the page.

    Ergo I use a macro called "look it up" that emulatesRecognition –>Press enter, and since the .insert[something]< used to the SearchVaue field, this command also *only fires the accordant Google search for the (up to 8) words inserted..


    I’m sure it is the best solution, but for now it works 100% of the time.


Comments are closed.

Skip to main content