News:

VC = Vox = VoxCommando
EG = EventGhost
WMC = Windows Media Center
WSR = Windows Speech Recognition

Main Menu

Weather pop-up window, using the WUnder and RoboB plugins

Started by nime5ter, February 22, 2015, 03:19:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nime5ter

PegLeg recently posted a nice command for those who use Kodi, if you prefer to see a pop-up view of your local weather rather than having VC read aloud the forecast to you. (http://voxcommando.com/forum/index.php?topic=2046)

His efforts inspired me to play with something I've been meaning to try for a while (thanks PegLeg  :D). The following is a pure VC pop-up weather widget, for those of us who don't use Kodi that much.

This requires enabling the Wunder plugin and the RoboB plugin.

The Wunder plugin provides a ton of special weather variables, so you could really customize this to your liking. I'm simply using their weather icon pictograph plus today's forecast.

You should format your WUnder forecasts the way you like them in the plugin settings, if you haven't already.

In my version, I am using the forecast format: Weather for {T0.title}: {T0.fcttext_metric} {T1.fcttext_metric}

You'll need to put the attached wunder.html template in your VC directory. You can format the web page however you like. The attached screen capture shows its current layout.

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.8-->
<commandGroup open="True" name="RoboB pop-up weather widget" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="312" name="weather pop-up" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Enable last action if you want the forecast read aloud as well.&#xD;&#xA;">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>wunder</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>WUnder.GetCustom</cmdType>
      <params>
        <param>{T0.icon_url}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>img</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>WUnder.GetForecast</cmdType>
      <params>
        <param>0</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>forecast</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>wunder.html</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(src=").*?("&gt;)</param>
        <param>$1{var.img}$2</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(&lt;div&gt;&lt;p&gt;).*?(&lt;/p&gt;&lt;/div&gt;)</param>
        <param>$1{var.forecast}$2</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Write</cmdType>
      <params>
        <param>wunder.html</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Navigate</cmdType>
      <params>
        <param>{Path.VC}\wunder.html</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Wait</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Show</cmdType>
      <params>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ShowFrame</cmdType>
      <params>
        <param>False</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.SetWinSize</cmdType>
      <params>
        <param>650</param>
        <param>250</param>
        <param>0</param>
        <param>0</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{var.forecast}</param>
      </params>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <phrase>Show today's weather</phrase>
  </command>
  <command id="385" name="hide weather pop-up" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>wunder</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Dispose</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>hide the weather pop-up</phrase>
  </command>
</commandGroup>


Version 2 (using slightly less lazy html, though still old-school ... 'cuz I'm old -- wunder2.html attached):
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<commandGroup open="True" name="RoboB pop-up weather widget" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="323" name="weather pop-up" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Enable last action if you want the forecast read aloud as well.&#xD;&#xA;">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>wunder</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>WUnder.GetCustom</cmdType>
      <params>
        <param>{T0.icon_url}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>img</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>WUnder.GetForecast</cmdType>
      <params>
        <param>0</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>forecast</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>wunder2.html</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(src=").*?("&gt;)</param>
        <param>$1{var.img}$2</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>(colspan="2"&gt;).*?(&lt;/td&gt;)</param>
        <param>$1{var.forecast}$2</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Write</cmdType>
      <params>
        <param>wunder2.html</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Navigate</cmdType>
      <params>
        <param>{Path.VC}\wunder2.html</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Wait</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Show</cmdType>
      <params>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ShowFrame</cmdType>
      <params>
        <param>False</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.SetWinSize</cmdType>
      <params>
        <param>570</param>
        <param>200</param>
        <param>0</param>
        <param>0</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>InputKeys.Send</cmdType>
      <params>
        <param>{F5}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{var.forecast}</param>
      </params>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <phrase>Show today's weather</phrase>
  </command>
  <command id="412" name="hide weather pop-up" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>wunder</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Dispose</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>hide the weather pop-up</phrase>
  </command>
</commandGroup>
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

PegLegTV


jitterjames

#2
It opens up a whole new realm of custom OSD possibilities...

For example, you could use RoboB to show now-playing info with album art etc.  8)

nime5ter

I've also been fooling around with a "now playing" RoboB pop-up that works with Kodi. See screenshot.

If enabled, it pops up every time a new music track starts, then disappears after 15s. (This is obviously customizable.)

It's a work in progress, but if anyone is interested let me know and I'll post the xml for it.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)