Author Topic: Gsm Arena Phones News  (Read 5450 times)

0 Members and 1 Guest are viewing this topic.

rio14

  • Contributor
  • ***
  • Posts: 59
  • Karma: 4
    • View Profile
Gsm Arena Phones News
« on: July 02, 2016, 01:32:57 AM »
Phones HEADLINES news from GSM ARENA

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.9-->
<commandGroup open="False" name="PHONES NEWS" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1305" name="GSM ARENA PHONES NEWS" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="20" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape</cmdType>
      <params>
        <param>http://www.gsmarena.com/rss-news-reviews.php3</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExSingle</cmdType>
      <params>
        <param>item.*?&lt;title&gt;&lt;.*?DATA.(.*?)\]</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>(Total: {#M} headlines){CR}****...Gsm Arena phones News...****</param>
        <param>29000</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>{i}. {Match.{i}.1}</param>
      </params>
      <cmdRepeat>5</cmdRepeat>
    </action>
    <action>
      <cmdType>PayloadXML.Clear</cmdType>
      <params>
        <param>payloads\Gsmarena.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PayloadXML.AddPair</cmdType>
      <params>
        <param>payloads\Gsmarena.xml</param>
        <param>{Match.{i}.1}</param>
        <param>{i}</param>
      </params>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.MatchConcat</cmdType>
      <params>
        <param> , </param>
        <param>5</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Gsm Arena Phones News...{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType />
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>News</event>
    <phrase>tell me the phones news</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\gsmarena.xml</payloadFromXML>
  </command>
  <command id="190" name="Read G S M headline number {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>headlines</param>
        <param>HEADLINE YOU ASKED FOR</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PayloadXML.GetValue</cmdType>
      <params>
        <param>payloads\gsmarena.xml</param>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>There is no headline number {1}.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>There is no headline number {1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>{var.headlines}...{LastResult}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>headline you are looking for</param>
            <param>8000</param>
            <param>-5</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.AddText</cmdType>
          <params>
            <param>{1}. {LastResult}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>Read phone</phrase>
    <phrase>headline number</phrase>
    <payloadRange>1,55</payloadRange>
    <phrase optional="true">again</phrase>
  </command>
  <command id="198" name="Read G S M  headlines {1} through {2}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>headlines</param>
        <param>headline you are looking for</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PayloadXML.GetValue</cmdType>
      <params>
        <param>payloads\gsmarena.xml</param>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>There is no headline number {1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>There is no headline number {1}.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.StopMacro</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Headline youre looking for...</param>
        <param>26000</param>
        <param>-5</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <loop>
      <loopParams>
        <from>{1}</from>
        <to>{2}</to>
      </loopParams>
      <loopActions>
        <action>
          <cmdType>PayloadXML.GetValue</cmdType>
          <params>
            <param>payloads\Gsmarena.xml</param>
            <param>{j}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.AddText</cmdType>
          <params>
            <param>{j}. {LastResult}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>headlines</param>
            <param>{var.headlines}...{LastResult}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </loopActions>
    </loop>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{var.headllines}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Read phone headlines</phrase>
    <payloadRange>1,55</payloadRange>
    <phrase>through</phrase>
    <payloadRange>1,55</payloadRange>
  </command>
</commandGroup>

« Last Edit: July 02, 2016, 01:42:23 AM by rio14 »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Gsm Arena Phones News
« Reply #1 on: July 02, 2016, 11:25:08 AM »
Thanks for posting. Looks like a good way to get updates on what's happening in the smartphone world.

I was inspired by your post to create a few extra, optional commands, for those who want more information after hearing the headlines.

In the xml collection of commands below, I've added:
  • A command so that people can ask to open the web page to read the full article.
  • A command group that gets enabled once someone opens that web page. Once this group is enabled, you can ask VC to read that GSM article aloud.
The RoboBrowser plugin needs to be enabled for #2 to work.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.9-->
<groupCollection open="True" name="GSM PHONE NEWS COLLECTION">
  <commandGroup open="True" name="PHONES NEWS" enabled="True" prefix="" priority="0" requiredProcess="" description="">
    <command id="1309" name="GSM ARENA PHONES NEWS" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="20" loop="False" loopDelay="0" loopMax="0" description="Revisions: I generate 2 separate payloadXML files. I changed the regex to capture both headline and link. New: Gsmarena-links.xml stores the URL link (value) for each headline (phrase). Gsmarena is still headline (value), headline number (phrase). ">
      <action>
        <cmdType>PayloadXML.Clear</cmdType>
        <params>
          <param>payloads\Gsmarena-links.xml</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Scrape</cmdType>
        <params>
          <param>http://www.gsmarena.com/rss-news-reviews.php3</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.RegExSingle</cmdType>
        <params>
          <param>item.*?&lt;title&gt;&lt;.*?DATA.(.*?)\].*?&lt;link&gt;(.*?)&lt;</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.MatchToXML</cmdType>
        <params>
          <param>payloads\Gsmarena-links.xml</param>
          <param>True</param>
          <param>True</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <params>
          <param>(Total: {#M} headlines){CR}****...Gsm Arena phones News...****</param>
          <param>29000</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>OSD.AddText</cmdType>
        <params>
          <param>{i}. {Match.{i}.1}</param>
        </params>
        <cmdRepeat>5</cmdRepeat>
      </action>
      <action>
        <cmdType>PayloadXML.Clear</cmdType>
        <params>
          <param>payloads\Gsmarena.xml</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>PayloadXML.AddPair</cmdType>
        <params>
          <param>payloads\Gsmarena.xml</param>
          <param>{Match.{i}.1}</param>
          <param>{i}</param>
        </params>
        <cmdRepeat>{#M}</cmdRepeat>
      </action>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <params>
          <param>Gsm Arena Phones News...</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>{i}. {Match.{i}.1} ...</param>
        </params>
        <cmdRepeat>5</cmdRepeat>
      </action>
      <phrase>tell me the phones news</phrase>
    </command>
    <command id="227" name="Read G S M headline number {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>headlines</param>
          <param>HEADLINE YOU ASKED FOR</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>PayloadXML.GetValue</cmdType>
        <params>
          <param>payloads\gsmarena.xml</param>
          <param>{1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <if ifBlockDisabled="False" ifNot="True">
        <ifType>LastActionSuccess</ifType>
        <ifParams>&amp;&amp;</ifParams>
        <then>
          <action>
            <cmdType>OSD.ShowText</cmdType>
            <params>
              <param>There is no headline number {1}.</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType>TTS.Speak</cmdType>
            <params>
              <param>There is no headline number {1}</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
        </then>
        <else>
          <action>
            <cmdType>TTS.Speak</cmdType>
            <params>
              <param>{var.headlines}...{LastResult}</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType>OSD.ShowText</cmdType>
            <params>
              <param>headline you are looking for</param>
              <param>8000</param>
              <param>-5</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType>OSD.AddText</cmdType>
            <params>
              <param>{1}. {LastResult}</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
        </else>
      </if>
      <phrase>Read phone</phrase>
      <phrase>headline number</phrase>
      <payloadRange>1,55</payloadRange>
      <phrase optional="true">again</phrase>
    </command>
    <command id="240" name="Read G S M  headlines {1} through {2}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>headlines</param>
          <param>headline you are looking for</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>PayloadXML.GetValue</cmdType>
        <params>
          <param>payloads\gsmarena.xml</param>
          <param>{1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <if ifBlockDisabled="False" ifNot="True">
        <ifType>LastActionSuccess</ifType>
        <ifParams>&amp;&amp;</ifParams>
        <then>
          <action>
            <cmdType>TTS.Speak</cmdType>
            <params>
              <param>There is no headline number {1}</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType>OSD.ShowText</cmdType>
            <params>
              <param>There is no headline number {1}.</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType>VC.StopMacro</cmdType>
            <params />
            <cmdRepeat>1</cmdRepeat>
          </action>
        </then>
        <else />
      </if>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <params>
          <param>Headline youre looking for...</param>
          <param>26000</param>
          <param>-5</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <loop>
        <loopParams>
          <from>{1}</from>
          <to>{2}</to>
        </loopParams>
        <loopActions>
          <action>
            <cmdType>PayloadXML.GetValue</cmdType>
            <params>
              <param>payloads\Gsmarena.xml</param>
              <param>{j}</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType>OSD.AddText</cmdType>
            <params>
              <param>{j}. {LastResult}</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType>Results.SetVar</cmdType>
            <params>
              <param>headlines</param>
              <param>{var.headlines}...{j}. {LastResult}</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
        </loopActions>
      </loop>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>{var.headlines}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>Read phone headlines</phrase>
      <payloadRange>1,55</payloadRange>
      <phrase>through</phrase>
      <payloadRange>1,55</payloadRange>
    </command>
    <command id="253" name=" Open web page for G S M headline number {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="1st getvalue looks up the headline based on headline number.&#xD;&#xA;2nd getvalue looks up URL based on headline phrase. Stores URL as a variable 'gsm-link', used in the 'read aloud' command.">
      <action>
        <cmdType>PayloadXML.GetValue</cmdType>
        <params>
          <param>payloads\Gsmarena.xml</param>
          <param>{1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>PayloadXML.GetValue</cmdType>
        <params>
          <param>payloads\Gsmarena-links.xml</param>
          <param>{LastResult}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>gsm-link</param>
          <param>{LastResult}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Launch.OpenURL</cmdType>
        <params>
          <param>{var.gsm-link}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Group.Enable</cmdType>
        <params>
          <param>ROBOB Read Aloud</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>Open web page for G S M headline number</phrase>
      <payloadRange>1,20</payloadRange>
    </command>
  </commandGroup>
  <commandGroup open="True" name="ROBOB Read Aloud" enabled="False" prefix="" priority="0" requiredProcess="" description="">
    <command id="243" name="Read this G S M article aloud" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>RoboB.Select</cmdType>
        <params>
          <param>gsm</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Navigate</cmdType>
        <params>
          <param>{var.gsm-link}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Wait</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.ElementByID</cmdType>
        <params>
          <param>review-body</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.GetText</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.SetEventTimer</cmdType>
        <params>
          <param>2m</param>
          <param>disableGroup</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <if ifBlockDisabled="False" ifNot="False">
        <ifType>LastActionSuccess</ifType>
        <ifParams>&amp;&amp;</ifParams>
        <then>
          <action>
            <cmdType>TTS.Speak</cmdType>
            <params>
              <param>{LastResult}</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
        </then>
        <else>
          <action>
            <cmdType>TTS.Speak</cmdType>
            <params>
              <param>Sorry, I'm not sure which article you mean.</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
        </else>
      </if>
      <phrase>Read this G S M article aloud</phrase>
    </command>
    <command id="277" name="Stop reading the story" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>TTS.Stop</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Group.Disable</cmdType>
        <params>
          <param>ROBOB Read Aloud</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>Stop reading the story</phrase>
    </command>
    <command id="151" name="auto disable this group" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>Group.Disable</cmdType>
        <params>
          <param>ROBOB Read Aloud</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <event>disableGroup</event>
    </command>
  </commandGroup>
</groupCollection>


The extra commands are just for fun. Most of the time the headlines sum up the stories well, so the original command group will be great for most users.

If you don't want to use my command collection, there are a few things in the original GSM ARENA PHONES NEWS command that should be corrected, as they might cause some problems.

The event and the payload XML that appear in the Command Tree should be deleted, as they are not used.



The only elements that should appear in the Command Tree  are the “Inputs” needed to trigger (i.e., execute) the command.

This command is triggered only if we say: “tell me the phones news”

The extra elements might prevent the command from executing properly because VC will expect to hear a payload phrase as well.

Or, if people are already using an event called "News" for some other command, they could run into problems because this command will also try to execute any time a News event is fired.
« Last Edit: July 02, 2016, 11:31:02 AM by nime5ter »
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)

NightSpeed

  • Jr. Member
  • **
  • Posts: 35
  • Karma: 0
    • View Profile
Re: Gsm Arena Phones News
« Reply #2 on: July 04, 2016, 09:42:44 PM »
Tested it and works great !! Thank you Really do appreciate the time you took to make this happen.