Author Topic: Open different news websites using payloadXML  (Read 2931 times)

0 Members and 1 Guest are viewing this topic.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Open different news websites using payloadXML
« on: June 22, 2013, 11:05:57 AM »
This example might be useful for newer VC users. I've created a command group in which I can browse to different news websites in Chrome.

I created a payload XML file in which I've mapped URLs to phrases. This group also includes very basic Chrome navigation -- close a Chrome tab or close the program itself.

Below is the code. The payload XML file "news.xml" is attached. You'll need to download the file and put it in your payloads folder for the News command to work properly.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="Chrome" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="427" name="News" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Launch.RawParam</cmdType>
      <cmdString>{Path.PFx86}\Google\Chrome\Application\chrome.exe&amp;&amp;{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Show news from, Show me, News from</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone">payloads\news.xml</payloadFromXML>
  </command>
  <command id="444" name="Close Chrome" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Window.Close</cmdType>
      <cmdString>Chrome</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Close Chrome</phrase>
  </command>
  <command id="450" name="Close tab" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Window.Focus</cmdType>
      <cmdString>Chrome</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>InputKeys.Send</cmdType>
      <cmdString>{CONTROL}({W})</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Close tab</phrase>
  </command>
</commandGroup>

NOTE: If Chrome is your default browser you can use the Launch.OpenURL action rather than Launch.RawParam. Then you don't need to specify the path to Chrome. (It's a good idea to experiment with the different launch actions to see which does what.)
« Last Edit: December 16, 2013, 01:17:24 PM 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)