hi all
i have reinstalled windows, and i don't know why google tts does not work on VC.
If you are still having problems with this, we would need more information. For example, you can enable logging in VC, then use commands that use the Google TTS so that we can see if any error messages or other relevant information is logged.
this is a payloaded headlines from Aljazeera site nearly 45 headlines and i want
to add the option of (say next news) next five headlines. thank you
In the command posted above, the payload xml is not properly storing the headlines. I'm not sure if you ever looked at the payload xml that is generated? This is because the command is trying to store {Match.x.2} values, but the regular expression only captures one pattern in (brackets) therefore there is no {Match.x.2}.
If you only want to capture one regular expression pattern, you can access that pattern as {Match.x.1} -- (or {Match.x}, actually)
See:
http://voxcommando.com/mediawiki/index.php?title=Variables#MatchesBelow I have provided 2 very different solutions to your problem. The first solution does not involve any Python coding, so it is a solution that any VoxCommando user should be able to create even if not a programmer.
Instead of asking for the "next 5" headlines, and having to keep track of how many headlines have been read, we can instead ask for a specific range of headlines, or just a single headline. This might be nice if you want to hear one of the headlines again:
"Read Al Jazeera headline number x", or "Read Al Jazeera headlines x through y".
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.7-->
<commandGroup open="True" name="Aljazeera news fixed" enabled="True" prefix="" priority="0" requiredProcess="" description="">
<command id="1289" name="Aljazeera fixed" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="20" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Scrape</cmdType>
<params>
<param>http://www.aljazeera.net/aljazeerarss/9ff80bf7-97cf-47f2-8578-5a9df7842311/99e42274-a82e-4930-bbd5-ba2b24a88a22</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.RegExSingle</cmdType>
<params>
<param>item.*?<title><.*?DATA.(.*?)\]</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>(Total: {#M} headlines){CR}****...أحدث الأخبار بموقع الجزيرة...****</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\Aljazeera.xml</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>PayloadXML.AddPair</cmdType>
<params>
<param>payloads\Aljazeera.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>VC.TriggerEvent</cmdType>
<params>
<param>Google.TTS</param>
<param>...أحدث الأخبار بموقع الجزيرة...{LastResult}</param>
<param>ar</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<event>News</event>
<phrase>tell me the news</phrase>
<payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\Aljazeera.xml</payloadFromXML>
</command>
<command id="460" name="Call Google.TTS" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="triggered by an event expecting 2 payloads
{1} text to speech
{2} language code">
<action>
<cmdType>RoboB.Select</cmdType>
<params>
<param>GoogleTranslate</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RoboB.Navigate</cmdType>
<params>
<param>https://translate.google.com/#en/{2}/{1}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<event>Google.TTS</event>
</command>
<command id="455" name="Google.TTS ready" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="triggered by an event expecting 2 payloads
{1} text to speech
{2} language code">
<action>
<cmdType>RoboB.Select</cmdType>
<params>
<param>GoogleTranslate</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RoboB.ElementByID</cmdType>
<params>
<param>gt-res-listen</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<if ifBlockDisabled="False" ifNot="False">
<ifType>LastActionSuccess</ifType>
<ifParams>&&</ifParams>
<then>
<action>
<cmdType>RoboB.Click</cmdType>
<params />
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RoboB.Hide</cmdType>
<params />
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else>
<action>
<cmdType>RoboB.Show</cmdType>
<params />
<cmdRepeat>1</cmdRepeat>
</action>
</else>
</if>
<event>RoboB.DocComplete.GoogleTranslate</event>
</command>
<command id="174" name="Read Al Jazeera 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>هنا هو الخبر تسأل عن</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>PayloadXML.GetValue</cmdType>
<params>
<param>payloads\Aljazeera.xml</param>
<param>{1}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<if ifBlockDisabled="False" ifNot="True">
<ifType>LastActionSuccess</ifType>
<ifParams>&&</ifParams>
<then>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>There is no headline number {1}.</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>VC.TriggerEvent</cmdType>
<params>
<param>Google.TTS</param>
<param>There is no headline number {1}</param>
<param>ar</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else>
<action>
<cmdType>VC.TriggerEvent</cmdType>
<params>
<param>Google.TTS</param>
<param>{var.headlines}...{LastResult}</param>
<param>ar</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>هنا هو الخبر تسأل عن</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 Al Jazeera</phrase>
<phrase>headline number</phrase>
<payloadRange>1,55</payloadRange>
<phrase optional="true">again</phrase>
</command>
<command id="182" name="Read Al Jazeera 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>هنا هو الخبر تسأل عن</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>PayloadXML.GetValue</cmdType>
<params>
<param>payloads\Aljazeera.xml</param>
<param>{1}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<if ifBlockDisabled="False" ifNot="True">
<ifType>LastActionSuccess</ifType>
<ifParams>&&</ifParams>
<then>
<action>
<cmdType>VC.TriggerEvent</cmdType>
<params>
<param>Google.TTS</param>
<param>There is no headline number {1}</param>
<param>ar</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>...هنا هو الخبر تسأل عن...</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\Aljazeera.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>VC.TriggerEvent</cmdType>
<params>
<param>Google.TTS</param>
<param>{var.headllines}</param>
<param>ar</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>Read Al Jazeera headlines</phrase>
<payloadRange>1,55</payloadRange>
<phrase>through</phrase>
<payloadRange>1,55</payloadRange>
</command>
</commandGroup>
Your original request was to add a command asking for the next 5 headlines. The easiest way to do that is to use a Python script that keeps track of how many headlines have been read aloud. Although it is a simple script, one does need to know how to code a bit.
Attached is the Python script. As always, it should be placed in the VC\PY folder.
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.7-->
<commandGroup open="True" name="Aljazeera news w/ python" enabled="True" prefix="" priority="0" requiredProcess="" description="">
<command id="1270" name="Aljazeera (payloads fixed)" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="20" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>PayloadXML.Clear</cmdType>
<params>
<param>payloads\Aljazeera.xml</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Scrape</cmdType>
<params>
<param>http://www.aljazeera.net/aljazeerarss/9ff80bf7-97cf-47f2-8578-5a9df7842311/99e42274-a82e-4930-bbd5-ba2b24a88a22</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.RegExSingle</cmdType>
<params>
<param>item.*?<title><.*?DATA.(.*?)\]</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>PayloadXML.AddPair</cmdType>
<params>
<param>payloads\Aljazeera.xml</param>
<param>{Match.{i}}</param>
<param>{i}</param>
</params>
<cmdRepeat>{#M}</cmdRepeat>
</action>
<action>
<cmdType>Results.SetVar</cmdType>
<params>
<param>max</param>
<param>{#M}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>PY.ExecFile</cmdType>
<params>
<param>PY\alj-script.py</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>VC.TriggerEvent</cmdType>
<params>
<param>alj_next5</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<event>News</event>
<phrase>tell me the news</phrase>
</command>
<command id="476" name="Call Google.TTS" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="triggered by an event expecting 2 payloads
{1} text to speech
{2} language code">
<action>
<cmdType>RoboB.Select</cmdType>
<params>
<param>GoogleTranslate</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RoboB.Navigate</cmdType>
<params>
<param>https://translate.google.com/#en/{2}/{1}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<event>Google.TTS</event>
</command>
<command id="440" name="Google.TTS ready" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="triggered by an event expecting 2 payloads
{1} text to speech
{2} language code">
<action>
<cmdType>RoboB.Select</cmdType>
<params>
<param>GoogleTranslate</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RoboB.ElementByID</cmdType>
<params>
<param>gt-res-listen</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<if ifBlockDisabled="False" ifNot="False">
<ifType>LastActionSuccess</ifType>
<ifParams>&&</ifParams>
<then>
<action>
<cmdType>RoboB.Click</cmdType>
<params />
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>RoboB.Hide</cmdType>
<params />
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else>
<action>
<cmdType>RoboB.Show</cmdType>
<params />
<cmdRepeat>1</cmdRepeat>
</action>
</else>
</if>
<event>RoboB.DocComplete.GoogleTranslate</event>
</command>
<command id="176" name="Next 5 al jazeera headlines" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>PY.ExecString</cmdType>
<params>
<param>myHeadlines({var.max})</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>Next 5 al jazeera headlines</phrase>
<phrase optional="true">please</phrase>
<event>alj_next5</event>
</command>
</commandGroup>
Since we can't count on other people to write customized scripts for us all the time, it is good to know that there are alternative solutions. We may have to change our goals slightly, or think about the problem differently. But usually there is a solution.
[Edit to alj-script attachment. Last line triggering the Google.TTS should not have been commented out. New attachment is correct. 5-May-2016]