Author Topic: How do I send a text to the browser?  (Read 3597 times)

Artiom

  • Guest
How do I send a text to the browser?
« on: July 29, 2017, 06:48:01 PM »
I want to say "Search youtube for <the name of a video>" to get it found and opened in the web browser.
And I want to say "Definition <word>" to get it openend in the browser on some dictionart website.
Is it possible?


Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: How do I send a text to the browser?
« Reply #1 on: July 29, 2017, 07:21:25 PM »
Well, there's not a way to do that out of the box since it's a very specific functionality you are needing.  Also, something to consider is VoiceAttack is geared more for knowing exactly what needs to be spoken ahead of time in order to be accurate and reliable.  That said, you can still do some things with a little legwork but bear in mind that the reliability of your requests will be diminished.

You can use a wildcard in your command phrase to allow for a that command to pick up anything that starts with, 'find video' (not using, 'youtube' as a phrase since the speech engine has a hard time with that... havent tried training that word specifically... ymmv).

So, your spoken command phrase would look like this: 
find video*
Note the * which means, 'starts with find video'.  That means that the command will execute any time it starts with, 'find video'.  So, 'find video spongebob' will execute the command (since it starts with, 'find video').

Next, you'll want to extract the part of the spoken phrase that's not part of the wildcard.  You can use the, '{CMD_AFTER}' token to get the value and put it into a variable:
Set Text [findVal] to '{CMD_AFTER}'

The last part is to launch your browser with the extracted text.  In order to do that, you'll need to URL encode your text so that it can be called as part of the browser's query string.  You can get the URL encoded value of the variable that we just created (findVal) by using the token {TXTURL:findVal}.  Just add it to the end of the query string like so:

Run application 'http://youtube.com/results?search_query={TXTURL:findVal}'

Attached is a profile with that command in it if you want to try it out.  Even though there's a lot of description above, it's only a 2-action command ;)

Artiom

  • Guest
Re: How do I send a text to the browser?
« Reply #2 on: July 30, 2017, 05:16:55 PM »
Gary, many thanks! Your reply is so exhausting, I'll write back when I try it!
« Last Edit: July 30, 2017, 06:13:12 PM by Artiom »

megs

  • Guest
Re: How do I send a text to the browser?
« Reply #3 on: August 03, 2017, 05:42:31 AM »
GOD, i'am here to claim the same question... thanks....