Author Topic: Select option 1-8 in Google search results  (Read 7960 times)

0 Members and 1 Guest are viewing this topic.

vcisawesome

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
    • View Profile
Select option 1-8 in Google search results
« on: June 10, 2015, 06:04:03 PM »
Hello,

When I have Google Chrome open and have a google search results page I am unable to select Option 1 and so forth. I am trying to accomplish this as per this video: https://youtu.be/5zFoYdHiFgA?t=1m31s
but to no avail. A walk-through to set this up properly would be appreciated.

I have the full version 2.0.1.0 running on Windows 7.

Thanx in advance.



Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #1 on: June 10, 2015, 06:33:06 PM »
Did you checked this first?

http://voxcommando.com/mediawiki/index.php?title=Options#Show_OSD_alternates

Quote
Note that, by default -- even if it recognizes possible alternates -- VC will automatically execute the most likely command (i.e. Option 1). You can disable this by checking the "don't execute if there are alternate commands" box (see below).

VC version 2.0.1.0 is really old, why did you not update to 2.1.4.5 or 2.1.4.8?

http://voxcommando.com/home/downloads/
« Last Edit: June 10, 2015, 06:37:04 PM by Kalle »
***********  get excited and make things  **********

vcisawesome

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #2 on: June 10, 2015, 07:09:06 PM »
Hi Kalle,

I have checked the link you provided, when I say Select Option 1 - it repeats the previous VC command. I want to be able to click any of the link results via VC.


If I install the latest version of Voxcommando will I need another license key?


Thanx in advance.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #3 on: June 10, 2015, 07:42:26 PM »
Hi, no the key is the same and if you run the new version on the same machine, vc do not need a new activation.


Ahh, for what you looking for is complete different as what is showing in the video.
I'm not really sure, because I'm not at home to test it: maybe you can use input.keys actions for keyboard emulation


http://voxcommando.com/mediawiki/index.php?title=Actions#InputKeys


I think the best way to do is by using a scrape action with a result.regex action, but I can't show you the way yet, maybe tomorrow.

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

vcisawesome

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #4 on: June 10, 2015, 08:13:24 PM »
Hi Kalle,

I have updated my VC to the latest version - I did not need the key and it works fine.

I thought about keyboard emulation but Chrome does not have a shortcut to open links in the results page.

I am interested in the scrape action with the result.regex action. I can't wait to see. I have been searching for how James did this (selecting Google results hyperlinks) but cannot find it.


I have watched the tutorial https://www.youtube.com/watch?v=G_tEroy_9Mw and am learning it but I would have thought there must be a Command that someone else wrote for this.


Look forward to hearing from you.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #5 on: June 10, 2015, 09:25:42 PM »
A other solution is to use a chrome plugin which generates for each entry a key - if you have this enabled you can use the Inputkey emulation, but only if the results have always the same key, but you can give it a try  ;)

https://chrome.google.com/webstore/detail/keyboard-navigation/abcekjakjehkpheoaadhkjfcdodpjbgk
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Select option 1-8 in Google search results
« Reply #6 on: June 11, 2015, 07:51:39 AM »
I was not selecting hyperlinks in the video.  I was always using alternates if the recognition engine's best guess was wrong. 

Yes.  Option 1 will always repeat the command.  This is how alternates in VC are designed to work.

The fact that I'm using alternates may not be so obvious because the recording only captured a portion of my screen.
« Last Edit: June 11, 2015, 08:13:19 AM by jitterjames »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #7 on: June 11, 2015, 03:11:26 PM »
I was able to get it to "work" with the VC Robobrowser plugin, but the result tags are changing dynamically - in other words: It works only for the first entry correct, which is not helpful.
I will try to figure out if the scrape action with regex will work, but this take some time. Maybe Haddood can help a bit  ::)


I'm sure nime5ter can help with a solution, because she is the "scrape- and regex." Queen  :bignod
***********  get excited and make things  **********

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #8 on: June 11, 2015, 07:14:44 PM »
Ok guys, now I can proudly present a solution  8)

copy the command group code below in your VC command tree


This command group contain following commands:

1. A google search with payload dictation as example: "search on google first us president" - which open your browser and show you results from the first page of Google search. This command stores also the first 5 matches in a maptable.

2. Now you can choose a match by voice: "show me match 3" and the command open the link which is stored as match 3 in the current tab. If you want check the other matches, ask for a other match.

3. say: "close tab" to close the current tab

You can edit the actions by your self if you want use more then 5 matches - have fun  ;)


Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.5-->
<commandGroup open="False" name="Google search and scrape" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="287" name="google search" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <params>
        <param>searching for {1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.CreateTable</cmdType>
      <params>
        <param>search_results</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.OpenURL</cmdType>
      <params>
        <param>https://www.google.de/search?q={1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Scrape</cmdType>
      <params>
        <param>https://www.google.de/search?q={1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>&lt;h3\sclass="\w+"&gt;&lt;a\shref="\Wurl\Wq=(.*?)&lt;</param>
        <param>{CR}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>search_results</param>
        <param>match 1</param>
        <param>{Match.1.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>search_results</param>
        <param>match 2</param>
        <param>{Match.2.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>search_results</param>
        <param>match 3</param>
        <param>{Match.3.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>search_results</param>
        <param>match 4</param>
        <param>{Match.4.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>search_results</param>
        <param>match 5</param>
        <param>{Match.5.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>here are the results which I have found for {1}.</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>search for, search on google, google search</phrase>
    <payloadDictation>payloadDictation: Regular</payloadDictation>
  </command>
  <command id="309" name="show match X" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>InputKeys.Send</cmdType>
      <params>
        <param>{LCONTROL}({W})</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Get</cmdType>
      <params>
        <param>search_results</param>
        <param>match {1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>http://(.*?)&amp;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.OpenURL</cmdType>
      <params>
        <param>{Match.1.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>show me, open</phrase>
    <phrase optional="true">match, entry, result</phrase>
    <payloadRange>1,5</payloadRange>
  </command>
  <command id="282" name="close tab" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>InputKeys.Send</cmdType>
      <params>
        <param>{LCONTROL}({W})</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>close tab</phrase>
  </command>
</commandGroup>
« Last Edit: June 17, 2015, 11:17:36 AM by jitterjames »
***********  get excited and make things  **********

vcisawesome

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #9 on: June 17, 2015, 02:17:09 AM »
Hi Kalle,

I have tried your function but it did not work. It opens a blank web page without any search results.

I was so excited to try it hoping it would work and I certainly appreciate your help - perhaps there is an additional function/plugin that is missing.


Please advise.

VCIA

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #10 on: June 17, 2015, 03:58:24 AM »
I tried it again and it works fine in my case.
What is the VC history window showing - any error?
Maybe you must change first the google search link in my the command, because it is "google.de" instead as "google.com".
You can also check what is saved as result in the maptable.

This command does not work with VoxCommandoSp version, because the SP version does not support payload dictation.
If you have run the SP version and you open the command editor, you will see the payloads in RED, which means this function is missing.
« Last Edit: June 17, 2015, 04:57:43 AM by Kalle »
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Select option 1-8 in Google search results
« Reply #11 on: June 17, 2015, 09:35:02 AM »
Kalle you must be testing from a different command that what is on the forum because the urls have odd tags around them that look like this:

Code: [Select]
[url]https://www.google.de/search?q={1}[/url]

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #12 on: June 17, 2015, 10:59:01 AM »
Ahh  damn, the command in my tree is correct. It looks like I have some problems to post code here in the forum (sometimes also the font size is different) - I have never set the odd tags  ::yikes

James, I can't edit the command above, because I'm not at home - maybe you can solve it for me  :hugs
I can show you this issue next time in a hangout, maybe you have an idea  ::saddest


@VCIA:  please change the URL in the command and I think then it will work
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Select option 1-8 in Google search results
« Reply #13 on: June 17, 2015, 11:15:55 AM »
OK, I removed the forum tags.

Now it will sort of work, but because of the way Google returns different types of results, you usually don't get the correct link for the match number you specify.  So it sort of works, but not really.

It is a good start, but I think the only way to do it is with RoboBrowser and some very careful RegEx.
« Last Edit: June 17, 2015, 11:18:16 AM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Select option 1-8 in Google search results
« Reply #14 on: June 17, 2015, 09:13:00 PM »
It seems nime5ter and I both had the same idea.  Here is a solution that is based on what we did separately.  When I started, I tried to adapt the excellent start that Kalle made, but it was not possible using scrape alone.  Eventually we ended up with this which is quite different, and relies only on a payloadXml command for selecting results after the search.

Make sure the RoboB plugin is enabled before trying to use this XML.

You start by asking:  "search for THING"
and then you can either say: "select result number 3" or "select result LINKTEXT" where LINKTEXT is what is shown in blue by google's result page.

It only uses major link results, not all the ads and subdomain results that you see at the top.  If someone wants to modify it to cover all the possible links that would be great.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.8-->
<groupCollection open="True" name="Web Search with RoboB and Google">
  <commandGroup open="True" name="Google search and scrape" enabled="True" prefix="" priority="0" requiredProcess="" description="">
    <command id="364" name="google search" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>searching for {1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Select</cmdType>
        <params>
          <param>Google</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Navigate</cmdType>
        <params>
          <param>https://www.google.ca/search?q={1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Wait</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Show</cmdType>
        <params>
          <param>True</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.SetWinSize</cmdType>
        <params>
          <param>1200</param>
          <param>1000</param>
          <param>390</param>
          <param>5</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.ElementByID</cmdType>
        <params>
          <param>rso</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.GetHTML</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.RegEx</cmdType>
        <params>
          <param>&lt;h3\sclass="r"&gt;&lt;a.onmousedown=.*?href="(.*?)"&gt;(.*?)&lt;/a&gt;&lt;/h3&gt;&lt;</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>PayloadXML.Clear</cmdType>
        <params>
          <param>payloads\GoogleSearch.xml</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <loop>
        <loopParams>
          <from>1</from>
          <to>{#M}</to>
        </loopParams>
        <loopActions>
          <action>
            <cmdType>PayloadXML.AddPair</cmdType>
            <params>
              <param>payloads\GoogleSearch.xml</param>
              <param>{Match.{j}.1}</param>
              <param>Number {j}</param>
              <param>False</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType>PayloadXML.AddPair</cmdType>
            <params>
              <param>payloads\GoogleSearch.xml</param>
              <param>{Match.{j}.1}?</param>
              <param>{Match.{j}.2}</param>
              <param>True</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
        </loopActions>
      </loop>
      <action>
        <cmdType>Group.Rebuild</cmdType>
        <params>
          <param>google results by payload xml</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>search for, google search</phrase>
      <payloadDictation>payloadDictation: Regular</payloadDictation>
    </command>
    <command id="245" name="close search results" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>RoboB.Select</cmdType>
        <params>
          <param>Google</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Dispose</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>close search results</phrase>
    </command>
  </commandGroup>
  <commandGroup open="True" name="google results by payload xml" enabled="True" prefix="" priority="0" requiredProcess="" description="">
    <command id="410" name="select result" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>opening {PF.1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Launch.OpenURL</cmdType>
        <params>
          <param>{1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>select result</phrase>
      <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\GoogleSearch.xml</payloadFromXML>
    </command>
  </commandGroup>
</groupCollection>

In the process of making these commands I discovered some small things that will be improved in the next release of VC.

In the main program, payloadXML files won't work as expected if two payloads have exactly the same value.  I did this on purpose back in the day but now I realize that there are valid reasons for allowing it.  As a work around I added a ? to the end of the value for the title based URL.  (You need to look at the macro to understand what I'm talking about.)

In roboBrowser I'm going to improve the focusing of the browser window to make it easier to send the RoboB keyboard emulation, and I'm adding actions to scroll the window.
« Last Edit: June 17, 2015, 09:19:27 PM by jitterjames »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #15 on: June 18, 2015, 03:57:36 AM »
Great work, fantastic!   ::bow
***********  get excited and make things  **********

vcisawesome

  • Jr. Member
  • **
  • Posts: 8
  • Karma: 0
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #16 on: June 18, 2015, 11:37:04 PM »
Wow,

This is excellent work. Thank you so much for this.

 ^-^


I have 2 questions as a followup:

1) Is there a way to run this outside the Robobrowser window; the reason I mention this is that I would have to close the tab from the search result in order to select another.

2) For scrolling on the results page (or any web page) I have noticed that when using the Sendkeys function there is no availability to use of the PageUP or PageDOWN key - unless I am mistaken; is there another way to get the use of these keys for web page navigation.


Once again many Thanx for the incredible work you have done. I am getting quite familiar with this software and am now at more than 90 commands and counting. When I show people a demonstration with VC coupled with the Ivona TTS voice responses people are in shear awe.


:clap


VCIA

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #17 on: June 19, 2015, 04:19:39 AM »
Ok, now I have add a new command, which allowed us to choose the next or previous result page.


here is a demo video which explain the commands: www.youtube.com/watch?v=FVJYs_Eqz7M


@VCIA: 1. A close "tab" command is already exist in the collection which close the RoboB window with the search results, then you can do another search and a new RoboB window will open. I have add also a "close result tab", which close the selected match tab in the chrome browser.
2. You can use a "SendKeys" action with {PGDN} or {PGUP}, but get sure you browser windows has focus  ;)

Here the Group_Collection (updated at 20.06.2015):

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.8-->
<groupCollection open="True" name="Web Search with RoboB and Google V3">
  <commandGroup open="True" name="Google search and scrape" enabled="True" prefix="" priority="0" requiredProcess="" description="">
    <command id="392" name="google search" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>searching for {1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Select</cmdType>
        <params>
          <param>Google</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.SetWinSize</cmdType>
        <params>
          <param>1200</param>
          <param>1000</param>
          <param>390</param>
          <param>5</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Show</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Navigate</cmdType>
        <params>
          <param>https://www.google.com/search?q={1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Wait</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.TriggerEvent</cmdType>
        <params>
          <param>auto search</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>search for, google search</phrase>
      <payloadDictation>payloadDictation: Regular</payloadDictation>
    </command>
    <command id="245" name="close search results" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>RoboB.Select</cmdType>
        <params>
          <param>Google</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Dispose</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>close search results</phrase>
    </command>
    <command id="308" name="next result page" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>RoboB.Show</cmdType>
        <params>
          <param>True</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.ElementByID</cmdType>
        <params>
          <param>pnnext</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Click</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Wait</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.TriggerEvent</cmdType>
        <params>
          <param>auto search</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>here are the next results</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>next result page</phrase>
    </command>
    <command id="334" name="previous result page" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>RoboB.Show</cmdType>
        <params>
          <param>True</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.ElementByID</cmdType>
        <params>
          <param>pnprev</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Click</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Wait</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.TriggerEvent</cmdType>
        <params>
          <param>auto search</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>here are the previous results</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>previous result page</phrase>
    </command>
    <command id="425" name="return to search results" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>RoboB.Select</cmdType>
        <params>
          <param>Google</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Show</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>return to search results</phrase>
    </command>
    <command id="389" name="auto rebuild results in payload xml for the current page" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>RoboB.ElementByID</cmdType>
        <params>
          <param>rso</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.GetHTML</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.RegEx</cmdType>
        <params>
          <param>&lt;h3\sclass="r"&gt;&lt;a.onmousedown=.*?href="(.*?)"&gt;(.*?)&lt;/a&gt;&lt;/h3&gt;&lt;</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>PayloadXML.Clear</cmdType>
        <params>
          <param>payloads\GoogleSearch.xml</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <loop>
        <loopParams>
          <from>1</from>
          <to>{#M}</to>
        </loopParams>
        <loopActions>
          <action>
            <cmdType>PayloadXML.AddPair</cmdType>
            <params>
              <param>payloads\GoogleSearch.xml</param>
              <param>{Match.{j}.1}</param>
              <param>Number {j}</param>
              <param>False</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
          <action>
            <cmdType>PayloadXML.AddPair</cmdType>
            <params>
              <param>payloads\GoogleSearch.xml</param>
              <param>{Match.{j}.1}?</param>
              <param>{Match.{j}.2}</param>
              <param>True</param>
            </params>
            <cmdRepeat>1</cmdRepeat>
          </action>
        </loopActions>
      </loop>
      <action>
        <cmdType>Group.Rebuild</cmdType>
        <params>
          <param>google results by payload xml</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <event>auto search</event>
    </command>
  </commandGroup>
  <commandGroup open="False" name="google results by payload xml" enabled="True" prefix="" priority="0" requiredProcess="" description="">
    <command id="410" name="select result" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>opening {PF.1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Launch.OpenURL</cmdType>
        <params>
          <param>{1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>select result, show me</phrase>
      <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\GoogleSearch.xml</payloadFromXML>
    </command>
    <command id="299" name="close tab" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
      <action>
        <cmdType>InputKeys.Send</cmdType>
        <params>
          <param>{LCONTROL}({W})</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <phrase>close result tab</phrase>
    </command>
  </commandGroup></groupCollection>
« Last Edit: June 20, 2015, 06:13:29 AM by Kalle »
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Select option 1-8 in Google search results
« Reply #18 on: June 19, 2015, 08:28:57 AM »

1) Is there a way to run this outside the Robobrowser window; the reason I mention this is that I would have to close the tab from the search result in order to select another.

2) For scrolling on the results page (or any web page) I have noticed that when using the Sendkeys function there is no availability to use of the PageUP or PageDOWN key - unless I am mistaken; is there another way to get the use of these keys for web page navigation.


Question 1.
...
It is a good start, but I think the only way to do it is with RoboBrowser and some very careful RegEx.

Question 2.

In the process of making these commands I discovered some small things that will be improved in the next release of VC.

...

In roboBrowser I'm going to improve the focusing of the browser window to make it easier to send the RoboB keyboard emulation, and I'm adding actions to scroll the window.

The scrolling issue with RoboB windows will be addressed in the next  release. Generally speaking, however, page up and page down emulation does exist in all three keyboard emulation methods that VC supports. As Kalle says, you'll want to make sure the Chrome window is focused using the Windows.Focus action first.
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)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Select option 1-8 in Google search results
« Reply #19 on: June 19, 2015, 08:54:03 AM »
the reason I mention this is that I would have to close the tab from the search result in order to select another.

It's not quite clear why this is, but I'm guessing that you mean that when a specific result opens in Chrome (or whatever your default browser is), the window opens on top of the RoboB window, hiding the search results page. Is that the issue?

If so, one easy solution is to add a "return to search results" type of command:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.8-->
<command id="411" name="return to search results" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>RoboB.Select</cmdType>
    <params>
      <param>Google</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Show</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>return to search results</phrase>
</command>

That will bring the RoboB Google search results page to the front.
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)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Select option 1-8 in Google search results
« Reply #20 on: June 19, 2015, 01:03:07 PM »
Ok, now I have add a new command, which allowed us to choose the next or previous result page.

here is a demo video which explain the commands: www.youtube.com/watch?v=FVJYs_Eqz7M

Great tutorial and demo Kalle.  :clap

I have only a couple of minor constructive criticisms to make it a bit better.

1 - You have an action RoboB.Select at the end of your command macro.  It doesn't make sense to put this at the end of a command.  It should always go at the beginning of the macro, before any other RoboB actions.

2 - Since you are already triggering the regex scan and payloadXML command using an "auto search" event for the "next result page" and "previous result page" it makes sense to use this same method for the initial search.  That way if you want to make any changes to the way the page is scanned and analyzed you only need to edit the actions in one place.  This is easier and helps to avoid errors.

So you could replace your original search with this one:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.5.0-->
<command id="364" name="google search" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>searching for {1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Select</cmdType>
    <params>
      <param>Google</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.SetWinSize</cmdType>
    <params>
      <param>1200</param>
      <param>1000</param>
      <param>390</param>
      <param>5</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Show</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Navigate</cmdType>
    <params>
      <param>https://www.google.com/search?q={1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.TriggerEvent</cmdType>
    <params>
      <param>auto search</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>search for, google search</phrase>
  <payloadDictation>payloadDictation: Regular</payloadDictation>
</command>

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #21 on: June 19, 2015, 01:36:39 PM »
Thanks James - you are right, RoboB.select is an accident by cloning the commands  :bonk


I think I did not understand the second part - can you show me on which place the "return to search result" must placed -I'm lost at the moment. ::duh
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Select option 1-8 in Google search results
« Reply #22 on: June 19, 2015, 03:10:32 PM »
You only need to look at the new version of the command I just posted to understand what I mean.

It has nothing to do with "return to search result"
« Last Edit: June 19, 2015, 03:23:13 PM by jitterjames »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Select option 1-8 in Google search results
« Reply #23 on: June 19, 2015, 04:20:34 PM »
Ahhhh sorry, now it is clear.
I have copied by mistake nime5ter code  :bonk


Again thanks, this makes absolute sense - I have updated the collection above: http://voxcommando.com/forum/index.php?topic=2208.msg19214#msg19214
and added also the "back to search result" feature from nime5ter.
« Last Edit: June 20, 2015, 06:18:23 AM by Kalle »
***********  get excited and make things  **********