Author Topic: RoboB - Robo Browser  (Read 41419 times)

0 Members and 1 Guest are viewing this topic.

Bleazle

  • $upporter
  • Contributor
  • *****
  • Posts: 60
  • Karma: 1
    • View Profile
Re: RoboB - Robo Browser
« Reply #15 on: November 09, 2013, 03:16:28 AM »
Excellent, thanks, it's working here  ;D

One thing, when music is playing (via MediaMonkey) I want to mute the volume when the RoboB response happens. I've tried adding a MM.Softmute action before the response & an unmute action after the response but the volume level doesn't change. Can this be done?

Cheers

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: RoboB - Robo Browser
« Reply #16 on: November 09, 2013, 07:26:34 AM »
Didn't work the softmute action at all or only not in your robob command?
Can you post the command code?
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: RoboB - Robo Browser
« Reply #17 on: November 09, 2013, 08:17:47 AM »
If you use TTS.speak it will not wait for the TTS to finish speaking before going on to the next action, so it will unmute almost immediately.  Using TTS.speaksync should solve the problem.

Bleazle

  • $upporter
  • Contributor
  • *****
  • Posts: 60
  • Karma: 1
    • View Profile
Re: RoboB - Robo Browser
« Reply #18 on: November 12, 2013, 03:24:15 PM »
Update: I couldn't get the muting to work but apart from that the above works well in that it no longer includes items crossed off the list but I found that when I used a command (e.g. Play Music) I was getting an HTML version of the shopping list showing up on my screen (as part of the command OSD) and in VoxWav. When I changed back to the "standard" version which checks for duplicates in OurGroceries this no longer happened (so now I just delete the crossed off items at the bottom of the screen). I'll have another look at the muting thing today...

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: RoboB - Robo Browser
« Reply #19 on: November 12, 2013, 04:07:35 PM »
Hi Bleazle,

Could you please post the code for the command that you're having problems with (i.e., your updated code with whatever changes you've made since James posted his fix for the OurGroceries deleted items problem).

And ideally, also your log file.  (http://voxcommando.com/mediawiki/index.php?title=Log)

Might be easier for us to help you problem solve that way. :)
« Last Edit: November 12, 2013, 04:09:46 PM 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)

Bleazle

  • $upporter
  • Contributor
  • *****
  • Posts: 60
  • Karma: 1
    • View Profile
Re: RoboB - Robo Browser
« Reply #20 on: November 13, 2013, 05:40:01 AM »
I've deleted the file I was playing with but I will have another crack when I get a chance and upload it if I don't have any luck, cheers.

Bleazle

  • $upporter
  • Contributor
  • *****
  • Posts: 60
  • Karma: 1
    • View Profile
Re: RoboB - Robo Browser
« Reply #21 on: November 15, 2013, 07:05:10 PM »
Hi guys

This is a little bit off topic but I figured this was the best place to post my question. OurGroceries is good but I've just installed ZipList (www.ziplist.com) which is far more versatile/powerful. I'm the cook in the house at the moment thanks to my wife working long hours so I want to make my job as easy as possible  ;D I have tweaked the OurGroceries group and changed it so that RoboBrowser opens up the ZipList shopping list but I can't get VC to check/add items to the shopping list. Looking at the page source for ZipList it is far more involved than the OurGroceries page source - I've tried a few different ID's but haven't had any luck. I have attached the Group Command with "????" noted, it would be great if someone could give me a clue as to what I need to do here..

Cheers

Dave

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: RoboB - Robo Browser
« Reply #22 on: November 15, 2013, 10:27:10 PM »
Yes, it's a little different. You can't use the element IDs in the same way because of how they've structured their page, and they don't have an import list function, which is what the OurGroceries command uses to add items. To add new items to the zip list you need to use their add item form field instead.

Are you familiar with how to use RoboB's "show" action with mouse tracking to find element IDs, etc.? That's a pretty useful way to inspect the page and find what you need. It's how I figured out the following.

The add item field's element ID is "zipbox_command". However, in order to actually submit your new item, you'll then need to emulate clicking on their "Add Item" button. If you roll over that button, you'll see that it's defined with an Input tag, index no. 6. You then need to use RoboB.Click to simulate a mouse-click, rather than using RoboB.Submit as we more commonly do.

The list itself is also formed differently than Our Groceries, which means you can't check existing list items by finding the right element ID. Instead you need to look for a pattern in how they are defining grocery items. They do this with span tags, class=iname. To find that pattern, we rely on ye olde regex.

Below is code that should work for you to add a new item to your list, including checking whether the item is already on your list before adding.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="robob ZipList high priority" enabled="False" prefix="" priority="5" requiredProcess="" description="">
  <command id="617" name="open list" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <cmdString>ZipList</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.SetWinSize</cmdType>
      <cmdString>800&amp;&amp;600</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Navigate</cmdType>
      <cmdString>http://www.ziplist.com/mylist/YOURLISTNUMBER</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Show</cmdType>
      <cmdString />
      <cmdRepeat>0</cmdRepeat>
    </action>
    <phrase>prepare, start, ready</phrase>
    <phrase>robo browser, our groceries, grocery list</phrase>
    <event>VC.Loaded</event>
  </command>
  <command id="695" name="Add Item" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <cmdString>ZipList</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementRegex</cmdType>
      <cmdString>span&amp;&amp;class=iname&gt;{1}&amp;&amp;False</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.GetText</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <cmdString>You already have {1} on your list</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.StopMacro</cmdType>
          <cmdString />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <cmdString>Processing</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>RoboB.ElementByID</cmdType>
      <cmdString>zipbox_command</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.SetText</cmdType>
      <cmdString>{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Wait</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementByTag</cmdType>
      <cmdString>INPUT&amp;&amp;6</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Click</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString>{1}, was added to your list</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>don't forget, remember, I need, We need, remind me</phrase>
    <phrase>to</phrase>
    <phrase>buy, purchase, get, pick up</phrase>
    <phrase optional="true">some, more, some more</phrase>
    <payloadFromXML phraseOnly="True" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">groceries.xml</payloadFromXML>
    <phrase optional="true">please</phrase>
  </command>
</commandGroup>

You'll have to take the same exploratory approach to figure out how to re-do the other commands as well, but hopefully this provides a helpful start for you.

cheers
« Last Edit: November 15, 2013, 10:39:07 PM 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)

Bleazle

  • $upporter
  • Contributor
  • *****
  • Posts: 60
  • Karma: 1
    • View Profile
Re: RoboB - Robo Browser
« Reply #23 on: November 16, 2013, 01:36:58 AM »
Thanks for the informative reply, unfortunately the code you posted doesn't work for me. The "Add Item" button Input tag is index no. 7 for me so I changed that, added a test payload ("beer" as it happens ;) ) and gave it a go - "beer" is entered into the "zipbox_command" field and the screen acts as though the "Add Item" button has been clicked (i.e. the screen fades out and the "wait" icon appears) but when the list re-loads the item hasn't been added. I tried all sorts of different things but nothing worked - unfortunately I eventually managed to crash VC so I can't show you what I tried  ::confused Did you manage to get items to load?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: RoboB - Robo Browser
« Reply #24 on: November 16, 2013, 01:49:26 PM »
I tried this command.  Input 6 was correct for me but for some reason the clicking of the button just made the page reload and the new item was not added.

This morning we figured out this method which seems to work reliably and is probably more efficient anyway.  Note that you will need to insert your listID in the second to last action.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="733" name="Add Item simple" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>RoboB.Select</cmdType>
    <cmdString>ZipList</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.ElementRegex</cmdType>
    <cmdString>span&amp;&amp;class=iname&gt;{1}&amp;&amp;False</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>LastActionSuccess</ifType>
    <ifParams>&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <cmdString>You already have {1} on your list</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.StopMacro</cmdType>
        <cmdString />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <cmdString>Processing</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <action>
    <cmdType>RoboB.Navigate</cmdType>
    <cmdString>http://www.ziplist.com/mylist/YOURLISTID/zipbox?utf8=%E2%9C%93&amp;zip_command={1}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <cmdString>{1}, was added to your list</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>don't forget, remember, I need, We need, remind me</phrase>
  <phrase>to</phrase>
  <phrase>buy, purchase, get, pick up</phrase>
  <phrase optional="true">some, more, some more</phrase>
  <payloadFromXML phraseOnly="True" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">groceries.xml</payloadFromXML>
  <phrase optional="true">please</phrase>
</command>

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: RoboB - Robo Browser
« Reply #25 on: November 16, 2013, 01:54:43 PM »
Looks like I was just lucky with the Input [6] click action working reliably for me. Possibly because my IE browser is an ancient version.
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 - Robo Browser
« Reply #26 on: November 16, 2013, 02:11:44 PM »
It is a mystery.  I can't think of any reason why it should not work.  Computers...  :bonk

Bleazle

  • $upporter
  • Contributor
  • *****
  • Posts: 60
  • Karma: 1
    • View Profile
Re: RoboB - Robo Browser
« Reply #27 on: November 16, 2013, 03:20:14 PM »
Thanks guys - items are now being added  :) but the "check if item is already on the list" part doesn't work. I changed the RoboB.ElementRegex patter to "iname" because "class=iname" was throwing an error in VC History but apart from that i haven't had any luck. Any ideas on this one?

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: RoboB - Robo Browser
« Reply #28 on: November 16, 2013, 03:42:34 PM »
This is just a guess, but: Do you still have the related "open list" command in your ziplist command group (or elsewhere in your tree), or did you delete that?

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="617" name="open list" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>RoboB.Select</cmdType>
    <cmdString>ZipList</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.SetWinSize</cmdType>
    <cmdString>800&amp;&amp;600</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Navigate</cmdType>
    <cmdString>http://www.ziplist.com/mylist/YOURLISTNUMBER</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Show</cmdType>
    <cmdString />
    <cmdRepeat>0</cmdRepeat>
  </action>
  <phrase>prepare, start, ready</phrase>
  <phrase>zip list, grocery list</phrase>
  <event>VC.Loaded</event>
</command>

The above command is supposed to be triggered when you first launch VC (via the VC.Loaded event). This is necessary for VC to know that the RoboBrowser called "ZipList" should navigate to the URL for your particular grocery list. If you still have that command, try manually triggering it before testing the add item command (whether with an appropriate voice command or by clicking on the open list command's play button in the command tree), to make sure that RoboBrowser has navigated to your grocery list.

If you're not going to use that command, then within the "Add Item" command you'll need to tell it to navigate to the URL of your list.

In other words:

For, the "Add Item" command to be able to check for existing items on your list, it needs to know where to look. The first RoboB.Select action in the Add Item command calls the ZipList RoboBrowser, with the expectation that this ZipList RoboB has already been created (i.e. by the other, "open list" command). If the "open list" command hasn't been triggered yet, it will simply create a RoboBrowser window to nowhere.

Am I making any sense?  :D (I'm very tired today, so I may not be very articulate!)

Point being, you should go back to using James's code, but make sure that the first thing that happens is that the ZipList robobrowser window has navigated to http://www.ziplist.com/mylist/YOURLISTNUMBER, whether you're doing that in the open list command or your add item command.

That said, the checking of items should only fail the first time you execute the add item command, because within that command you eventually do provide a URL. I suspect that you only tested it once?
« Last Edit: November 16, 2013, 04:35:16 PM 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 - Robo Browser
« Reply #29 on: November 16, 2013, 05:04:30 PM »
Thanks guys - items are now being added  :) but the "check if item is already on the list" part doesn't work. I changed the RoboB.ElementRegex patter to "iname" because "class=iname" was throwing an error in VC History but apart from that i haven't had any luck. Any ideas on this one?
It is supposed to "throw an error" if the item is not in your list.  We are using "if last action success" in our logic.

If there is an error it means no success, no error means success.

No error means which in turn means, the item was found, meaning "you already have this item in your list".

An error means you don't already have the item in your list so we should add it.
« Last Edit: November 16, 2013, 09:35:40 PM by jitterjames »