Author Topic: Getting VC To Read  (Read 5684 times)

0 Members and 1 Guest are viewing this topic.

pmdaniels73

  • $upporter
  • Sr. Member
  • *****
  • Posts: 118
  • Karma: 0
    • View Profile
Getting VC To Read
« on: April 28, 2014, 10:44:56 PM »
How do I or is there a way to edit this command to get VC to read out loud the first several lines of the page that is pulled up when doing a lucky search? Actually I am trying to accomplish something like in the video below. Starting at about the 47 second mark.

https://www.youtube.com/watch?v=3D9GNVa0HlU


Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="266" name="lucky search" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Launch.OpenURL</cmdType>
    <cmdString>http://google.com/search?sourceid=navclient&amp;btnI=1&amp;q={1}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <cmdString>displaying results for {1}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>lucky search</phrase>
  <payloadDictation>payloadDictation: Regular</payloadDictation>
</command>
« Last Edit: April 28, 2014, 10:50:46 PM by pmdaniels73 »

pmdaniels73

  • $upporter
  • Sr. Member
  • *****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Getting VC To Read
« Reply #1 on: April 30, 2014, 01:53:23 AM »
So I figured out how to get VC to read to me. But how do I specify what part of the page I want VC to read?

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Getting VC To Read
« Reply #2 on: April 30, 2014, 09:33:41 AM »
The video you link to is doing some fairly advanced stuff. All this is possible in VC; it requires the usual powerful tools -- scraping and regular expressions. Or, in the case of VC, the RoboBrowser plugin makes things a bit simpler once you get familiar with how it works.

Simple is a relative term, of course.

I don't recommend using a Google lucky search if you want to have trivia read aloud to you, because while the lucky search usually finds excellent matches, for the program to know what to read aloud to you, it needs to "understand" what to read aloud on a page full of all kinds of information (like ads and menus, etc.). That means you need to provide the computer with specific patterns to look for.

Because of this, I recommend that for your particular objective of reading aloud online trivia/encyclopaedic info you always use Wikipedia, which has a standard page structure. This makes it easier to tell VC what pattern to look for.

The following command requires that you enable the RoboBrowser plugin, if you haven't yet.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.0.0.0-->
<command id="1161" name="++Search wikipedia" 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>RoboB.Select</cmdType>
    <params>
      <param>newwiki</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Navigate</cmdType>
    <params>
      <param>http://en.wikipedia.org/wiki/{1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Show</cmdType>
    <params>
      <param>True</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>vc.pause</cmdType>
    <params>
      <param>2000</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.ElementRegex</cmdType>
    <params>
      <param>p</param>
      <param>&lt;b&gt;</param>
      <param>False</param>
      <param>True</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.GetText</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <params>
      <param>\(.*?\)</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegExReplace</cmdType>
    <params>
      <param>\[\d+\]</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>{LastResult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Dispose</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Search wikipedia for</phrase>
  <payloadDictation>payloadDictation: Regular</payloadDictation>
</command>

It finds the first paragraph of the Wikipedia entry and reads it aloud. The command also eliminates text contained within parentheses and footnote annotations (using regular expressions -- see the Results.RegExReplace actions), since your interest appears to be in retrieving general encyclopaedic trivia.

As you can see, the voice command is relying on payload dictation. As you know, this has its drawbacks.

However, if you also have "Show OSD Alternates" enabled in your options, and ideally are preventing VC from automatically executing commands with multiple alternates until you've told it which option to choose, it can work quite well.

I have tested the following queries and they all worked nicely:

Search wikipedia for Robert Downey Junior
Search wikipedia for Oprah Winfrey
Search wikipedia for Montreal
Search wikipedia for elephants

Give it a whirl. Hopefully it will work for you.

... Obviously you can change the phrasing of the command and create a few phrasing alternatives.

« Last Edit: May 19, 2015, 01:38:08 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)

pmdaniels73

  • $upporter
  • Sr. Member
  • *****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Getting VC To Read
« Reply #3 on: April 30, 2014, 01:01:47 PM »
Thanks Naomi. I copied the xml file that you posted. When I tried to paste it into my tree nothing happened though.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Getting VC To Read
« Reply #4 on: April 30, 2014, 01:45:20 PM »
Thanks Naomi. I copied the xml file that you posted. When I tried to paste it into my tree nothing happened though.

This is a textbook example of the kind of post that is going to earn you some serious smiting, and will make us very reluctant to attempt to help you in the future.  I'm not trying to be mean but this is a reality check.  You can consider the case closed on this one.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Getting VC To Read
« Reply #5 on: April 30, 2014, 02:38:51 PM »
http://voxcommando.com/mediawiki/index.php?title=Getting_support

See especially "Other Specific Tips".

A good, short blurb for everyone to read -- *and learn from*.
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)

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Getting VC To Read
« Reply #6 on: April 30, 2014, 03:38:31 PM »
Thanks Naomi. I copied the xml file that you posted. When I tried to paste it into my tree nothing happened though.
I know robo browser and regex things a bit tricky and I'm sure you will never find out how you can use it in the right way, so it is very appreciate that Naomi create and post a ready to use COMMAND, which you must only copy in a COMMAND-GROUP and that the Robot Browser plugin must be enabled in VC is also described above.
I think what James mean that you ask often for a ready to use solution without reading the forum rules first - if anyone bought a car from you and then he ask you a day later - "the car which I bought from you doesn't run, why?" - This question contains no information about what he have done - so there are many possibilities for what it could be.

I have test the command above and it works fantastic - good Job Naomi

Kalle
***********  get excited and make things  **********

pmdaniels73

  • $upporter
  • Sr. Member
  • *****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Getting VC To Read
« Reply #7 on: May 01, 2014, 01:13:06 PM »
This is a textbook example of the kind of post that is going to earn you some serious smiting, and will make us very reluctant to attempt to help you in the future.  I'm not trying to be mean but this is a reality check.  You can consider the case closed on this one.

Thanks James.

pmdaniels73

  • $upporter
  • Sr. Member
  • *****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Getting VC To Read
« Reply #8 on: May 02, 2014, 01:51:16 AM »
I know robo browser and regex things a bit tricky and I'm sure you will never find out how you can use it in the right way, so it is very appreciate that Naomi create and post a ready to use COMMAND, which you must only copy in a COMMAND-GROUP and that the Robot Browser plugin must be enabled in VC is also described above.
I think what James mean that you ask often for a ready to use solution without reading the forum rules first - if anyone bought a car from you and then he ask you a day later - "the car which I bought from you doesn't run, why?" - This question contains no information about what he have done - so there are many possibilities for what it could be.

I have test the command above and it works fantastic - good Job Naomi

Kalle


Thanks Kalle! I am not real sure on what else to explain. The process I went through is pretty simple. All I done was copied the command that is posted above. Then went into my tree editor. Then right clicked within the tree and clicked on paste. When I done this the command did not show up in the tree. That's it.

vulcanjedi

  • $upporter
  • Sr. Member
  • *****
  • Posts: 213
  • Karma: 8
    • View Profile
Re: Getting VC To Read
« Reply #9 on: May 02, 2014, 02:25:39 AM »
pmdaniels73, I too did not encounter any issues pasting the above embedded xml into VCv1.9.3.1
I know nothing of robobrowser so just affirmed the pasting xml into the MDI/Command Tree Editor part.
I'd suggest perhaps making a secondary install someplace another folder/machine real quick just to see if you can reproduce or perhaps provide screencap
You're not even getting / providing any error, which anytime I tried to paste and it failed I believe a descriptive error was presented to me.



Thanks Kalle! I am not real sure on what else to explain. The process I went through is pretty simple. All I done was copied the command that is posted above. Then went into my tree editor. Then right clicked within the tree and clicked on paste. When I done this the command did not show up in the tree. That's it.
« Last Edit: May 02, 2014, 02:28:49 AM by vulcanjedi »

pmdaniels73

  • $upporter
  • Sr. Member
  • *****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Getting VC To Read
« Reply #10 on: May 02, 2014, 02:56:06 AM »
pmdaniels73, I too did not encounter any issues pasting the above embedded xml into VCv1.9.3.1
I know nothing of robobrowser so just affirmed the pasting xml into the MDI/Command Tree Editor part.
I'd suggest perhaps making a secondary install someplace another folder/machine real quick just to see if you can reproduce or perhaps provide screencap
You're not even getting / providing any error, which anytime I tried to paste and it failed I believe a descriptive error was presented to me.



You are correct. I am not getting any error messages. I am getting ready to try your suggestions now though to see if it works.

pmdaniels73

  • $upporter
  • Sr. Member
  • *****
  • Posts: 118
  • Karma: 0
    • View Profile
Re: Getting VC To Read
« Reply #11 on: May 02, 2014, 03:46:54 AM »
pmdaniels73, I too did not encounter any issues pasting the above embedded xml into VCv1.9.3.1
I know nothing of robobrowser so just affirmed the pasting xml into the MDI/Command Tree Editor part.
I'd suggest perhaps making a secondary install someplace another folder/machine real quick just to see if you can reproduce or perhaps provide screencap
You're not even getting / providing any error, which anytime I tried to paste and it failed I believe a descriptive error was presented to me.



I tried a different install on this machine. Then tried on another machine. Still no luck. Below is a video I posted to show exactly what the steps are that I am taking.

https://www.youtube.com/watch?v=pMVM1_URR38&feature=youtu.be

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Getting VC To Read
« Reply #12 on: May 02, 2014, 06:46:46 AM »
And that is what we mean, you did not read the posts above correctly, so this is my last attempt in this theme to help you.

1. You can't copy a COMMAND (Naomi's code is a command) on a empty place in the Editortree. (The only thing which is curious, is that you get normaly a message when you placed a command outside from a group in the tree  ::hmm
You can recognize whether it is a command or a command group on the first lines in the code - if it contain <commandGroup...> it is a Group if it contain <command...> it is a command.

example for how looks a command Group code at the first lines:

<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="bot robo test" enabled="True" prefix="" priority="0" requiredProcess="" description="">

example for how looks a command code at the first lines:

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.3.1-->
<command id="...>

To insert Naomi's code, create first a empty command group in your tree by a click on the "folder symbol" in the editor and then you can paste the code by moving the mouse over the created folder and click paste - thats all.

here is also a video answer: www.youtube.com/watch?v=oxVNj8k1SeU
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Getting VC To Read
« Reply #13 on: May 02, 2014, 08:06:56 AM »
Excellent video Kalle!

I think the error message you see is only in version 2.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Getting VC To Read
« Reply #14 on: May 02, 2014, 08:22:40 AM »
Great video, Kalle. Thanks for taking the time to do that!

From Paul's video, I can see that he is using 1.191 (that would have been helpful info, btw). That is why he didn't get the same error message that you demonstrate in your video, but the functionality is the same.

Here in the attached screen capture, you can see the same information in the wiki documentation that Kalle has provided twice.

@Paul: Thanks for posting your video, that was a good idea. I think posting videos may be the most efficient solution in the future. "Nothing happened" could mean many things:

1. We didn't know what version you were using.
2. We didn't know whether the "nothing happens" part happened after you'd tried to issue the command or when you were importing the command, or at some other point.
3. We didn't know whether you were getting any feedback from VC (as vulcanjedi mentioned).
4. We didn't know if the RoboBrowser plugin had been enabled (i.e., whether you'd tried to follow all of the instructions provided).

---
"I am using version 1.191. I selected and copied all of the xml in the command block. When I opened my tree and tried to paste it at the bottom of my tree using right-click, the command did not seem to show up in the tree. I kept seeing the word "paste" but no sign of the command. There is no error message that I can see in the history panel."






« Last Edit: May 02, 2014, 08:28:47 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)