Author Topic: Control Chrome browser with VC DE/EN  (Read 10638 times)

0 Members and 2 Guests are viewing this topic.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Control Chrome browser with VC DE/EN
« on: May 04, 2012, 07:54:33 AM »
Here is an VC-group with german and english phrases to control "Google-Chrome-Browser"

Import the "VcGrp_Chrome_hotkeys_and_control" in VC editor and edit the phrases by your self (if you want)
Save the "dxdirectionEnDe.xml" in the VC main folder, this xml is for using the scroll command
The DxInput-plugin must be enabled

have fun
Kalle
« Last Edit: May 05, 2012, 01:57:34 AM by Kalle »
***********  get excited and make things  **********

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: Control Chrome browser with VC DE/EN
« Reply #1 on: July 25, 2013, 05:14:08 PM »
Thanks Kalle.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Control Chrome browser with VC DE/EN
« Reply #2 on: July 25, 2013, 05:47:49 PM »
***********  get excited and make things  **********

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: Control Chrome browser with VC DE/EN
« Reply #3 on: July 30, 2013, 05:34:07 PM »
hey kalle im having small problem. i created a url.xml with the value set as "http://lifehacker.com/" and the phrase as "life hacker" but when i tell vox to open life hacker, the osd displays but it doesnt browse to the site. am i doing something wrong here?

Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<!--A VoxCommando Payload file-->
<PayloadsRoot>
    <payload>
        <value>http://192.168.0.10:8090/</value>
        <phrase>sab n z b</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
    <payload>
        <value>https://remote.utorrent.com/</value>
        <phrase>u torrent</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
    <payload>
        <value>http://192.168.0.10:8092/home/</value>
        <phrase>sick beard</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
    <payload>
        <value>http://192.168.0.10:8093/</value>
        <phrase>couch potato</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
    <payload>
        <value>http://lifehacker.com/</value>
        <phrase>life hacker</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
</PayloadsRoot>
« Last Edit: July 30, 2013, 05:39:23 PM by IKROWNI »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Control Chrome browser with VC DE/EN
« Reply #4 on: July 30, 2013, 06:00:25 PM »
The payloadxml seems OK, but can you please post the XML for the command that you are using?

Just right-click the command in your tree and then paste it into a code block as you have done above.

Thanks.

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: Control Chrome browser with VC DE/EN
« Reply #5 on: July 30, 2013, 11:09:23 PM »
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="266" name="open url with payload" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>InputKeys.TextEntry</cmdType>
    <cmdString>{1}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{LastResult}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>DxInput.KeyPress</cmdType>
    <cmdString>return</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>open</phrase>
  <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone">payloads\url.xml</payloadFromXML>
</command>

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Control Chrome browser with VC DE/EN
« Reply #6 on: July 31, 2013, 01:09:06 AM »
Kalle or James will hopefully correct me if I'm off base, but I think that command will only effectively browse to a new site if your cursor is already in the address bar.

In Kalle's XML, there's a command to open a "new tab". At that point, the cursor is in the address bar and "open Life Hacker" will work as expected.

I would be inclined to use Launch.OpenURL if Chrome was my default browser, or maybe Launch.RawParam if it isn't. e.g.:

Code: [Select]
</cmdType>
    <?xml version="1.0" encoding="utf-16"?>
<command id="427" name="News" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Launch.RawParam</cmdType>
    <cmdString>{Path.PFx86}\Google\Chrome\Application\chrome.exe&amp;&amp;{1}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Open</phrase>
  <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\url.xml</payloadFromXML>
</command>

If the browser is already open, this opens the payload URL in a new tab rather than redirecting to a new site within the current tab. If the latter is what you're trying to accomplish, maybe some other kind of keyboard emulation could be used to first highlight the address bar (like ^(L)) before trying to open the URL of interest.
« Last Edit: July 31, 2013, 01:17:24 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)

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Control Chrome browser with VC DE/EN
« Reply #7 on: July 31, 2013, 03:58:42 AM »
Quote
Kalle or James will hopefully correct me if I'm off base, but I think that command will only effectively browse to a new site if your cursor is already in the address bar.

That is absolute correct  :bignod

I've upgraded the "open URL" command and insert a logic block:

If you say "open (your URL)"
then VC check if your chrome browser is running - if it is, it open a new tab with your requested URL and give you a TTS feedback
If the chrome browser doesn't run, it open it with your requested URL and give you also a TTS feedback.

Have fun  ;)

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="628" name="open url with payload / öffne URL" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>ProcessRunning</ifType>
    <ifParams>chrome.exe&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>Window.Focus</cmdType>
        <cmdString>chrome</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>SendKeys</cmdType>
        <cmdString>^t</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>InputKeys.TextEntry</cmdType>
        <cmdString>{1}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <cmdString>{LastResult}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>DxInput.KeyPress</cmdType>
        <cmdString>return</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>Launch.OpenURL</cmdType>
        <cmdString>{1}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <cmdString>{LastResult}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <cmdString>I've open a new tab with the requested webpage</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>open, öffne</phrase>
  <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone">payloads\url.xml</payloadFromXML>
</command>
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Control Chrome browser with VC DE/EN
« Reply #8 on: July 31, 2013, 08:56:26 AM »
Cool. I like your idea with the logic block and the TTS announcement. This gives me the opportunity to try using a friendly payload, which I've been wanting to do for a while. My adaptation of your command looks like this:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="628" name="open url with payload / öffne URL" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>ProcessRunning</ifType>
    <ifParams>chrome&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>Window.Focus</cmdType>
        <cmdString>chrome</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.Pause</cmdType>
        <cmdString>5</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>SendKeys</cmdType>
        <cmdString>^l</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.Pause</cmdType>
        <cmdString>5</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>DxInput.Type</cmdType>
        <cmdString>{1}{RETURN}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <cmdString>{1}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>Launch.OpenURL</cmdType>
        <cmdString>{1}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <cmdString>{1}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <cmdString>Browsing to {PF.1}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>open</phrase>
  <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\url.xml</payloadFromXML>
</command>

Here, VoxCommando checks if Chrome is open. If so, then it will open the new URL in the currently open tab, rather than opening a new tab. If Chrome is not yet running, it opens Chrome (if Chrome is set as my default browser) and goes to the requested URL.

[I don't know if I really need those pauses, but with keyboard emulation it seems to be more reliable on my computer when I pause between actions.]
« Last Edit: July 31, 2013, 09:01:20 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)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Control Chrome browser with VC DE/EN
« Reply #9 on: July 31, 2013, 10:19:02 AM »
Looks like my work is done here   ;D

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Control Chrome browser with VC DE/EN
« Reply #10 on: July 31, 2013, 10:32:29 AM »
Looks like my work is done here   ;D
Nooooooooooooooooo, absolutely not. I would say this is a open challenge  :D
The next step is to create the same command, but if the browser is open VC ask the user to open the URL in a new tab or in the currently open tab (with confirmation)

@nime5ter: you can use instead of "SendKeys" ^l in your command the "DxInput.KeyCombo" {leftcontrol}{l} and you need also no pause (you can use the KeyPress Delay in the DXplugin if you need)
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Control Chrome browser with VC DE/EN
« Reply #11 on: July 31, 2013, 10:44:36 AM »
I prefer to use inputKeys actions wherever possible.  Especially when sharing code with new users.

Inputkeys usually works fine and doesn't require you to enable an extra plugin.  Also if you use directX plugin, you need to set the delay correctly for the keys to work.  That delay is the time the button is held down, so I would not use it to pause a macro.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Control Chrome browser with VC DE/EN
« Reply #12 on: July 31, 2013, 10:47:59 AM »
Nooooooooooooooooo, absolutely not. I would say this is a open challenge  :D
The next step is to create the same command, but if the browser is open VC ask the user to open the URL in a new tab or in the currently open tab (with confirmation)

Well, for me, this is not an interesting exercise.  Maybe for someone else.  As a user I prefer to always open in a new tab anyway, and that is how I have my system set up.  I use other commands to switch and close tabs.  >:D

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Control Chrome browser with VC DE/EN
« Reply #13 on: July 31, 2013, 10:56:23 AM »
Quote
I prefer to use inputKeys actions wherever possible.  Especially when sharing code with new users.
Haha, you've right, but the code above is mixed with SendKeys and DxInput so I have only change the SendKeys with DxInput.KeyCombo to clean it up.  ::club
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Control Chrome browser with VC DE/EN
« Reply #14 on: July 31, 2013, 11:07:19 AM »
I prefer to use inputKeys actions wherever possible.  Especially when sharing code with new users.

Inputkeys usually works fine and doesn't require you to enable an extra plugin.

True, but particularly since Kalle's entire command group uses the direct x plugin anyhow, I used DxInputkeys to type the address in the existing window because it seemed to require fewer lines/hassles than the regular Inputkeys.

I was able to enter the URL into the address bar and hit 'return' in the same action, rather than having to first type the URL in one action and then separately send 'return' in the next. Or can that be done still with the regular Inputkeys actions?

There are times when I want to open a site in a new tab, and other times where I don't. Kalle's command group already has a separate "new tab" command, so one could always say, "New tab." and then "Open Life Hacker" to accomplish the former.

Either way, what's cool is that there are so many different ways to do things and to customize it all to our own preferences and ways of thinking. That may cause confusion for new users at first, but they'll love the flexibility once they start to get the hang of things, I think.
« Last Edit: July 31, 2013, 11:10:14 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)