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

0 Members and 1 Guest are viewing this topic.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • 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: 2319
  • 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: 7713
  • 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: 2009
  • 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: 2319
  • 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: 2009
  • 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: 7713
  • 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: 2319
  • 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: 7713
  • 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: 7713
  • 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: 2319
  • 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: 2009
  • 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)

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Control Chrome browser with VC DE/EN
« Reply #15 on: July 31, 2013, 11:09:49 AM »
Quote
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.

:hugs
« Last Edit: July 31, 2013, 01:12:15 PM 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 #16 on: July 31, 2013, 04:01:07 PM »
well it seems to be trying to open lifehacker now, but now when my browser opens through vox it crashes all of my chrome extensions and i just get a blank browser startup page.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Control Chrome browser with VC DE/EN
« Reply #17 on: July 31, 2013, 06:08:57 PM »
well it seems to be trying to open lifehacker now, but now when my browser opens through vox it crashes all of my chrome extensions and i just get a blank browser startup page.
Did you use the DxInput plugin? Play with the keypress delay in the plugin settings (test it first with 20) and take also a look to your other commands - it is possible you use a same phrase "open" perhaps in a launch command.
I've test all the posted code above - it works.
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Control Chrome browser with VC DE/EN
« Reply #18 on: July 31, 2013, 06:35:25 PM »
I've tested the all the launch actions on many systems and never had a problem (and no user has reported a problem before this) so unfortunately for you this problem is specific to your system, or to your macro.  If you want to post the final command xml code that you are using I will look at it to be sure.  As Kalle points out, maybe the problem is with keyboard emulation or something similar.  If you are using Launch.Url you could try switching to Launch.RawParam, or vice versa to see if it makes a difference, or try another browser.  The Launch actions are all managed code using standard .NET methods, so it should work fine and there is almost no chance that this is due to an error in the VC program itself.

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: Control Chrome browser with VC DE/EN
« Reply #19 on: July 31, 2013, 06:42:46 PM »
Did you use the DxInput plugin? Play with the keypress delay in the plugin settings (test it first with 20) and take also a look to your other commands - it is possible you use a same phrase "open" perhaps in a launch command.
I've test all the posted code above - it works.

im working with a completely fresh install of vox. i also just tried another one that has had nothing modified except turning on dxinput and adding your files. ive also turned dxinput settings to 20. I am still getting the same issue when chrome launches just a blank screen that says all of my extensions have crashed at the bottom right. I thought maybe it was an issue with my extensions so i turned them all off completely, still the same issue but without the popups notifying me of extension crashes.

This works fine as long as i have chrome already open but no matter what i do if i use vox to open chrome itself it crashes. ive also tried creating a command just to open chrome alone using:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="300" name="launch chrome" 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</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>open, launch, run, start</phrase>
  <phrase>chrome, google chrome, web browser, browser</phrase>
</command>


still this does not work either so it must be isolated as you said.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Control Chrome browser with VC DE/EN
« Reply #20 on: July 31, 2013, 06:48:01 PM »
You could try a few things

- Uninstall chrome - reinstall it

- Try another browser like IE or firefox if you have it installed.  This might not be a good solution for you but it would be interesting to see if the problem is with chrome only.

- Use a batch file to open chrome.  this could still be set up to use your payloads with a little fancy footwork...

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: Control Chrome browser with VC DE/EN
« Reply #21 on: July 31, 2013, 06:50:04 PM »
fixed it im an idiot. had VC installed in my documents folder instead of in my programs(x86). moving it there seems to have fixed it all. im guessing a permissions problem?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Control Chrome browser with VC DE/EN
« Reply #22 on: July 31, 2013, 06:52:27 PM »
Normally I strongly recommend against putting it in your program files folder.

go figure.

I don't know about your other folder permissions, but normally it does not work well in program files unless you open VC as admin every time, because windows won't let VC write files in that location.  (permission thing)

Might be that you solved the proglem simply by moving to a new location.  Try C:\VoxCommando or similar.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Control Chrome browser with VC DE/EN
« Reply #23 on: July 31, 2013, 06:55:58 PM »
It could be that when you run it from there it is asking your for permission to run as admin?  If that is the case, it could be that elevated privilege that vox now has allows you to open chrome without problems, but normally this should not be necessary.

IKROWNI

  • $upporter
  • Sr. Member
  • *****
  • Posts: 146
  • Karma: 2
    • View Profile
Re: Control Chrome browser with VC DE/EN
« Reply #24 on: July 31, 2013, 09:53:53 PM »
yep works fine at the root level of my c: drive i dont know of any permissions that would have stopped vox from accessing it but it all seems to be working great now, thanks again fellas.