Author Topic: RoboB questions  (Read 4991 times)

0 Members and 3 Guests are viewing this topic.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
RoboB questions
« on: October 15, 2014, 12:36:19 AM »
couple of questions about RoboB,

is there a way to hide the tracking and highlight strip ?
what is the best way to send keyboard presses to RoboB running in full screen mode ?
Is there a way to tell what is the page address RoboB currently viewing ?
« Last Edit: October 15, 2014, 05:30:41 AM by Haddood »
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: RoboB questions
« Reply #1 on: October 15, 2014, 12:29:08 PM »
is there a way to hide the tracking and highlight strip ?
Read the action description in the LCB / Action selection tree.  RoboB.Show provides this functionality.

what is the best way to send keyboard presses to RoboB running in full screen mode ?
Take your pick:
- InputKeys
- SendKeys
- DxInput

You can also directly control some html elements on your roboBrowser to set text, submit, and emulate mouse clicks on those elements. 
- RoboB.Submit
- RoboB.Click
- RoboB.SetText
There are several examples of doing this that can be found on the forum.

Is there a way to tell what is the page address RoboB currently viewing ?
An event is generated whenever a page finishes loading.  The event name will be RoboB.DocComplete.YOUR_ROBO'S_NAME  and the event includes a payload which is the URL of the page that finished loading.  If you want to check the URL of the last page loaded in other commands you will need to use this event to update a variable.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: RoboB questions
« Reply #2 on: October 18, 2014, 10:20:22 PM »
Read the action description in the LCB / Action selection tree.  RoboB.Show provides this functionality.

found it thank you ...

Take your pick:
- InputKeys
- SendKeys
- DxInput

doing some tests ... what is the difference between Input Keys and Send Keys

An event is generated whenever a page finishes loading.  The event name will be RoboB.DocComplete.YOUR_ROBO'S_NAME  and the event includes a payload which is the URL of the page that finished loading.  If you want to check the URL of the last page loaded in other commands you will need to use this event to update a variable.
that is wonderful ... already solved may issues I was facing using this...

A new question comes into my mind, How do I focus robob window? to make sure the send key or input key is going to the right window?
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: RoboB questions
« Reply #3 on: October 18, 2014, 10:41:31 PM »
what is the difference between Input Keys and Send Keys
http://voxcommando.com/mediawiki/index.php?title=Actions#InputKeys


A new question comes into my mind, How do I focus robob window? to make sure the send key or input key is going to the right window?
http://voxcommando.com/mediawiki/index.php?title=Plugin_RoboB#Show

RoboB.Show will focus the window, but if another program is in front of VoxCommando it will not bring it in front of this other window so you would need to use Window.Focus to focus VC first.

If you use the RoboB actions such as RoboB.Click to manipulate an element then focus is not an issue.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: RoboB questions
« Reply #4 on: October 19, 2014, 12:44:53 AM »
http://voxcommando.com/mediawiki/index.php?title=Actions#InputKeys
Thank you. I think I should learn to refer to wiki more often... It is like ikea instruction, one do not read until calling for help from five friends  :biglaugh :biglaugh
However I was hoping for a more technical answer, like one use windows messages and the other use something else

RoboB.Show will focus the window, but if another program is in front of VoxCommando it will not bring it in front of this other window so you would need to use Window.Focus to focus VC first.

If you use the RoboB actions such as RoboB.Click to manipulate an element then focus is not an issue.
Sounds good plan ... I will test what happens if VC was minimized to system tray

Thanks again for all the help


When Voice command gets tough, use hand gestures

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: RoboB questions
« Reply #5 on: October 19, 2014, 05:43:55 AM »
a question about the RoboB.DocComplete event,

the more I use the browser ... the more it triggers events (see image). not sure if it is a bug or it is meant to be, or there is a way to control it.

P.S. I did check the wiki, RoboB page do not mention anything about the event  ::) ::)

When Voice command gets tough, use hand gestures

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: RoboB questions
« Reply #6 on: October 19, 2014, 08:52:22 AM »
From what you're showing, I'm not seeing that it's triggering many events -- just one event triggering two commands that have the same name.

That is, it looks like you have two commands with the same name in your tree. If they're doing the same thing, delete one of them.
« Last Edit: October 19, 2014, 08:55:52 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: RoboB questions
« Reply #7 on: October 19, 2014, 09:59:02 AM »
or possibly you only have one command but you have assigned the event to it twice.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: RoboB questions
« Reply #8 on: October 19, 2014, 07:31:22 PM »
or possibly you only have one command but you have assigned the event to it twice.
I am afraid it is not the case ...

From what you're showing, I'm not seeing that it's triggering many events -- just one event triggering two commands that have the same name.

That is, it looks like you have two commands with the same name in your tree. If they're doing the same thing, delete one of them.

Nime5ter, that is what I meant :) ... I can't figure why that event triggering the command twice .. in fact it is exponential, the more I browse the more times it triggers the command

I am attaching a log, screen shot of the command tree and the xml of the command being triggered many times .... if you guys have a Netflix account or willing to try it for free I will post the whole thing.

to prepare the log, I existed VC ... deleted the log, then started VC...

put VC to off (so it does not hear other commands) - this happens at line 2275, so everything before is VC starting  ::) ::)

using tellvox, I issued the following commands:
  • Start Netflix (this disables all Groups except the group Netflix)
  • Browse my list
  • Go Back
  • Browse my list
  • exit Netflix (this restore groups and disable Netflix)

then closed VC again ...

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.0.5-->
<command id="365" name="Current Page" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>VcAdvanced.Log</cmdType>
    <params>
      <param>----------------------- Start: NetFlix Current Page ----------------------------------</param>
      <param>{1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetVar</cmdType>
    <params>
      <param>NetFlixURL</param>
      <param>{1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Select</cmdType>
    <params>
      <param>NetFlix</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;login</ifParams>
    <then>
      <action>
        <cmdType>VcAdvanced.Log</cmdType>
        <params>
          <param>---------------- NetFlix: Performing Login --------------</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.ElementByID</cmdType>
        <params>
          <param>email</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.SetText</cmdType>
        <params>
          <param>{Var.NetFlixID}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.ElementByID</cmdType>
        <params>
          <param>password</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.SetText</cmdType>
        <params>
          <param>{Var.NetFlixPW}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.ElementByID</cmdType>
        <params>
          <param>RememberMe</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.Click</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.ElementByID</cmdType>
        <params>
          <param>login-form-contBtn</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.StopMacro</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;WiMovie</ifParams>
    <then>
      <action>
        <cmdType>VcAdvanced.Log</cmdType>
        <params>
          <param>NetFlix: Movie Page no need to refresh</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.StopMacro</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;ProfilesGate</ifParams>
    <then>
      <action>
        <cmdType>VcAdvanced.Log</cmdType>
        <params>
          <param>NetFlix: Profile Selection - no need to refresh</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.StopMacro</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;WiHome</ifParams>
    <then>
      <action>
        <cmdType>VcAdvanced.Log</cmdType>
        <params>
          <param>---------------- NetFlix: Login Successful --------------</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.TriggerEvent</cmdType>
        <params>
          <param>NetFlix.RefreshGenre</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <action>
    <cmdType>VC.TriggerEvent</cmdType>
    <params>
      <param>NetFlix.RefreshMovies</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VcAdvanced.Log</cmdType>
    <params>
      <param>----------------------- End: NetFlix Current Page ----------------------------------</param>
      <param>{1}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>RoboB.DocComplete.NetFlix</event>
</command>

and here is refresh movies ...

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.0.5-->
<command id="340" name="Refresh Movies list" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="&lt;a class=&quot;playHover uitracking-state-visible&quot; href=&quot;http://www.netflix.com/WiPlayer?movieid=70253799&amp;amp;trkid=13462986&amp;amp;tctx=0,403,47ffa07e-bc8b-41cb-ab94-bffaa94417c0-12238323&quot; data-uitrack=&quot;70253799,13462986,0,403&quot;&gt;&lt;/a&gt;&#xD;&#xA;&#xD;&#xA;http://www.netflix.com/WiPlayer?movieid=70157152&#xD;&#xA;">
  <action>
    <cmdType>VcAdvanced.Log</cmdType>
    <params>
      <param>--------------------------------------- Start: NetFlix movie list refresh --------------------------------------- </param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>PayloadXML.NewFile</cmdType>
    <params>
      <param>{Path.VC}\payloads\NetFlixMovies.xml</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Select</cmdType>
    <params>
      <param>NetFlix</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{Var.NetFlixURL}&amp;&amp;WiHome</ifParams>
    <then>
      <action>
        <cmdType>VcAdvanced.Log</cmdType>
        <params>
          <param>page not supported</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.StopMacro</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>RoboB.ElementByXY</cmdType>
        <params>
          <param>100</param>
          <param>300</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.ElementParent</cmdType>
        <params />
        <cmdRepeat>3</cmdRepeat>
      </action>
      <action>
        <cmdType>RoboB.GetHTML</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>alt="(.*?)"\s.*?http://www.netflix.com/WiPlayer\?movieid=(.*?)&amp;</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>PayloadXML.Clear</cmdType>
    <params>
      <param>{Path.VC}\payloads\NetFlixMovies.xml</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.MatchToXML</cmdType>
    <params>
      <param>{Path.VC}\payloads\NetFlixMovies.xml</param>
      <param>True</param>
      <param>True</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>PayloadXML.AddPair</cmdType>
    <params>
      <param>{Path.VC}\payloads\NetFlixMovies.xml</param>
      <param>{Match.{i}.2}</param>
      <param>{Match.{i}.1}</param>
      <param>True</param>
    </params>
    <cmdRepeat>0</cmdRepeat>
  </action>
  <action>
    <cmdType>VcAdvanced.Log</cmdType>
    <params>
      <param>--------------------------------------- End: NetFlix movie list refresh --------------------------------------- </param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Group.Rebuild</cmdType>
    <params>
      <param>NetFlix</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>NetFlix.RefreshMovies</event>
</command>

and here is the one that refresh genre
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.0.5-->
<command id="478" name="Refresh Genre" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="http://www.netflix.com/WiGenre?agid=9327">
  <action>
    <cmdType>VcAdvanced.Log</cmdType>
    <params>
      <param>--------------------------------------- Start: NetFlix Genre list refresh --------------------------------------- </param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>PayloadXML.NewFile</cmdType>
    <params>
      <param>{Path.VC}\payloads\NetFlixGenre.xml</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Select</cmdType>
    <params>
      <param>NetFlix</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.ElementByTag</cmdType>
    <params>
      <param>A</param>
      <param>1</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.ElementParent</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.ElementParent</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.GetHTML</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.Replace</cmdType>
    <params>
      <param>amp;</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>&lt;a\shref="http://www.netflix.com/WiGenre\?agid=(.*?)"&gt;(.*?)&lt;/a&gt;</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>PayloadXML.Clear</cmdType>
    <params>
      <param>{Path.VC}\payloads\NetFlixGenre.xml</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>PayloadXML.AddPair</cmdType>
    <params>
      <param>{Path.VC}\payloads\NetFlixGenre.xml</param>
      <param>{Match.{i}.1}</param>
      <param>{Match.{i}.2}</param>
      <param>False</param>
    </params>
    <cmdRepeat>0</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.MatchToXML</cmdType>
    <params>
      <param>{Path.VC}\payloads\NetFlixGenre.xml</param>
      <param>False</param>
      <param>True</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VcAdvanced.Log</cmdType>
    <params>
      <param>--------------------------------------- End: NetFlix Genre list refresh --------------------------------------- </param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>NetFlix.RefreshGenre</event>
</command>
« Last Edit: October 19, 2014, 09:46:52 PM by jitterjames »
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: RoboB questions
« Reply #9 on: October 19, 2014, 10:31:54 PM »
Ahhh. There seems to be a bug with the Group.Rebuild action.

VC is reloading the group and loading events, but the events are being added to the ones that have already been registered (the original association is not being cleaned first like it should be) so when the event is triggered it will execute the commands associated with that event more than once.   :bonk

If you rebuild the group 5 times, then the command will be called 6 times. (The original load + 5 rebuilds).  Thanks for bringing this to light.

Hopefully I can fix this bug, but in the meantime the easy solution for you is probably to switch your command to use the Group.RefreshAll action instead of Group.Rebuild.  RefreshAll purges all events before reloading.  This action is actually pretty efficient (it won't rebuild grammars if the phrases and payloads have not changed), although you should not be calling it any more than necessary.  The way you have it set up you are calling refresh movies constantly which is making VC do a huge amount of unnecessary work.  This is probably only needed once at day at most and you have it set up to do this almost any time any netflix page loads.  I recommend you fix this first.

Another optional fix for the multiple event bug would be to rebuild only groups that don't contain events.  You would need to restructure things a bit, but it makes sense anyway to only put the commands that actually will change into the groups that you rebuild, and the event driven commands do not change, it is only the commands that are using the new payloadXMLs that need to be updated.
« Last Edit: October 19, 2014, 10:35:00 PM by jitterjames »

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: RoboB questions
« Reply #10 on: October 19, 2014, 11:52:06 PM »
 :clap :clap
You caught it ... the 2 commands with same name shouldn't be the reason as each triggered by different event and only one of them enabled at a time.

I will use refresh all ... For the time being or wait till you fix it ... No rush.
I was planning to reduce the amount of rebuilds, but sure it won't be once a day... As things might change from other devices so it has to be dynamic ...
As well the current setup uses one movie xml for all pages ... Meaning one command so it is simple ... I will see if I can come with an elegant solution to keep user experience fluid

Thank you guys for taking the time to look into this ... God knows how many pitcher of beer I owe you till now ... At one point might just buy you a brewery  :biglaugh :biglaugh
« Last Edit: October 20, 2014, 02:00:49 AM by Haddood »
When Voice command gets tough, use hand gestures

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: RoboB questions
« Reply #11 on: March 23, 2015, 05:37:10 PM »
@Haddood

Any updates on your Netflix approach?
« Last Edit: March 23, 2015, 06:04:35 PM by lja »

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: RoboB questions
« Reply #12 on: March 24, 2015, 02:33:40 AM »
@Haddood

Any updates on your Netflix approach?

Shared it long time ago here: http://voxcommando.com/forum/index.php?topic=1802.0
When Voice command gets tough, use hand gestures