Author Topic: Perform "Ok Google" search?  (Read 3133 times)

0 Members and 1 Guest are viewing this topic.

RickyD333

  • Contributor
  • ***
  • Posts: 71
  • Karma: 2
    • View Profile
Perform "Ok Google" search?
« on: April 14, 2015, 04:57:09 AM »
So I was just playing around and right clicked on the mic that appears on the Google Search bar and selected "inspect element", which I'm sure most of you know brings up the code for that particular element. I was digging around in VoxCommando to see if I can somehow select that mic via my voice and perform a Goggle voice search that way. I'd dig around more but my brain seems to have hit a wall and I'm trying to figure this out after a long day of bartending. Definitely going to look into it in the morning with a clear head, but thought maybe I would ask here for any thoughts.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Perform "Ok Google" search?
« Reply #1 on: April 14, 2015, 11:26:13 AM »
You can do a Google search or lucky search using VC and get the same search results.

If it's very important to you to use Google voice recognition instead of VoxCommando's speech recognition, under certain circumstances this is also possible.

see jitterjames's post and the follow-up post

http://voxcommando.com/forum/index.php?topic=2053.msg17805#msg17805
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)

RickyD333

  • Contributor
  • ***
  • Posts: 71
  • Karma: 2
    • View Profile
Re: Perform "Ok Google" search?
« Reply #2 on: April 14, 2015, 04:25:24 PM »
Well, I couldn't exactly get it to work with the xml that was provided in that thread. But I did figure out how to make it work with a simulated mouse press. I found that I can input x,y coordinates for the mouse and simulate a left click. So I just automated the mouse cursor to click the Ok Google mic. I wanted to figure this out because Google Voice searches seem to be more reliable than the MS voice recognition software. For example, if I say "Google search Stargate," MS comes up with some other weird word. But if I use Google voice search it picks it up perfectly. Google just seems to be much more reliable.

I think now I want to figure out how I can select a search result via voice.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.8-->
<command id="248" name="Google Ok Google" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Launch.OpenURL</cmdType>
    <params>
      <param>http://google.com/search?sourceid=navclient&amp;q=</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.Pause</cmdType>
    <params>
      <param>3000</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Sound.PlayWav</cmdType>
    <params>
      <param>C:\Users\Ricky\Desktop\clicking.wav</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Mouse.MoveAbsolute</cmdType>
    <params>
      <param>1230,410</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Mouse.LeftClick</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.Pause</cmdType>
    <params>
      <param>5000</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Google search</phrase>
</command>
« Last Edit: April 14, 2015, 04:28:36 PM by RickyD333 »

frobig

  • Jr. Member
  • **
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Perform "Ok Google" search?
« Reply #3 on: April 16, 2015, 08:48:01 AM »
That's awesome, thanks for this awesome topic guys

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Perform "Ok Google" search?
« Reply #4 on: July 10, 2015, 05:37:55 AM »
@Ricky ... how about launching it in RoboB ... then you can generate voice feedback and let the user to choose the result by voice !!

oops ...never mind ... Just realised that "ok google" works only in chrome
When Voice command gets tough, use hand gestures

SteveB69

  • Contributor
  • ***
  • Posts: 72
  • Karma: -1
    • View Profile
Re: Perform "Ok Google" search?
« Reply #5 on: January 08, 2016, 11:17:09 PM »
Good idea, never really used google voice search but it does work well.

Couple of questions, is there a way to get VC to pause until google has loaded, problem is sometimes this is one second, some times 10 seconds. I can't put in the left click until the microphone icon is visible?www.google.co.uk

The other question is my mouse co-ordinates don't always go to where they should, but sometimes they do. Maybe a topic for another topic but thought I'd mention.

Actually there is a hotkey of Ctrl + Shift + . (period) that will start voice search when your on the google page. Only problem is I don't know how we send . (period) into VC but it's a better option as web pages change design & the mic icon will no doubt be put somewhere else at some point.
Chances are I've searched the forum, searched the wiki & scoured You Tube but I'm just to thick to work it out without help!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Perform "Ok Google" search?
« Reply #6 on: January 09, 2016, 04:31:39 PM »
Actually there is a hotkey of Ctrl + Shift + . (period) that will start voice search when your on the google page. Only problem is I don't know how we send . (period) into VC

If you are using InputKeys.Send it is OEM_PERIOD

So the correct parameter to pass for that key combination would be:
Code: [Select]
{SHIFT+CONTROL}({OEM_PERIOD})
Using the keyboard you will still have to wait until the page loads.  I don't think there is any way to know when it has loaded though so to be safe you would need to find the longest time possible and use that.  So 10 seconds for you.