News:

HOT TIP! Enable the History Window in the main UI when trying to problem solve. It provides a handy log of what is happening. Roll over lines in the History to get more details.

Main Menu

RoboB - Robo Browser

Started by jitterjames, July 07, 2012, 06:30:13 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Oktane83

Ok I got it working with james' help. This is awesome. One question I had was when regex returns the result "A" is there anyway to make TTS say "Available"?

Thanks.

Kalle

#46
Yes sure, there are different ways to do this. You can use the "Results.RegExReplace" or "Results.Replace" and then TTS.Speak {LastResult}
You can also use a logic block (if-then-else) like: IF (A==B) / parameter for A {LastResult}  parameter for B A THEN TTS.Speak Available.
***********  get excited and make things  **********

Oktane83

Ok! Thats what I thought, I was doing that but it wasn't working. Now its working! One wrong character and the whole thing malfunctions lol. Im totally new to this.

Anyways im actually doing if A==B {Match.1} instead of {LastResult} as that was querying the entire HTML.

But anyways its working. If Im on rest it will tell me what time im on rest until else it will say im rested!

This program rocks, this site rocks, you guys rock!


Cheers!

Kalle

Thanks, nice to hear that it works  :)
I can feel with you, sometimes do I make the same fault  :bonk
***********  get excited and make things  **********

Oktane83

Ok all that seemed easy now I'm pulling my hair out trying to implement the second part of my little project. This first one just told me about my own personal status. But now I would like to have Vox TTS the status of the rest of the employees on the spareboard. Im trying to use regex to get the data but its driving me nuts. Im not sure if there is a better way to implement this.

This is the HTML from the page Im using.

<TD>Spare Board : BRAKEMAN SPAREBOARD</TD></TR>
<TR align=center>
<TD>Sub District : WINNIPEG</TD></TR>
<TR align=center>
<TD>Yard Tag Location Indicator : </TD></TR></TBODY></TABLE></DIV>
<DIV>
<TABLE id=gvDetail0 style="FONT-SIZE: 10pt; BORDER-TOP: lightgrey 2px solid; FONT-FAMILY: Arial; BORDER-RIGHT: lightgrey 2px solid; BORDER-BOTTOM: lightgrey 2px solid; FONT-WEIGHT: normal; BORDER-LEFT: lightgrey 2px solid" borderColor=lightgrey cellSpacing=2 cellPadding=2 rules=all align=center border=2>
<TBODY>
<TR style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-IMAGE: url(../media/beige.jpg?F5CH=I)" align=center>
<TH scope=col>Employee</TH>
<TH scope=col>Position</TH>
<TH scope=col>Rest<BR>yy-mm-dd/hh:mm</TH>
<TH scope=col>USHR<BR>hh:mm</TH>
<TH scope=col>MTOD<BR>hh:mm</TH>
<TH scope=col>Road / Yard</TH>
<TH scope=col>Yard Starts</TH></TR>
<TR style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: lightgrey" align=center>
<TD>ANDERCHEK, M.(MIKE) PC ESB</TD>
<TD>01</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD></TR>
<TR style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: whitesmoke" align=center>
<TD>PAGE, S. (STEPHEN) PC</TD>
<TD>02</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD></TR>
<TR style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: lightgrey" align=center>
<TD>MCWILLIAMS, S. SHAUN CR PC</TD>
<TD>03</TD>
<TD>14-03-29/06:00</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD></TR>
<TR style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: whitesmoke" align=center>
<TD>BEITZ, T. (TOM) PC CRO</TD>
<TD>04</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD></TR>
<TR style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: lightgrey" align=center>
<TD>ESSLINGER, C. (CHRIS) PC</TD>
<TD>05</TD>
<TD>14-03-29/16:22</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD>
<TD>&nbsp;</TD></TR>
<TR align=center>
<TD style="BACKGROUND-IMAGE: url(../media/beige.jpg?F5CH=I)" colSpan=7>&nbsp;</TD></TR>
<TR style="FONT-SIZE: 10pt; FONT-FAMILY: Arial; COLOR: red" align=left>
<TD style="BACKGROUND-IMAGE: url(../media/beige.jpg?F5CH=I)" colSpan=7>Data current as of 3/28/2014 6:54:31 PM Mar. 28, 2014 06:54 (GMT-4)</TD></TR></TBODY></TABLE></DIV></DIV><!-- End code changes --><BR><!-- End code changes --></FORM></TD></TR>
<TR>
<TD>
<HR>
</TD></TR>
<TR>
<TD align=center>
<TABLE width="100%">
<TBODY>
<TR>
<TD width="50%" align=right><!--<a href="javascript:history.back()">Back</a>&nbsp;--><INPUT onclick=history.back() id=back type=button value=Back name=back>&nbsp; </TD>
<TD width="50%" align=left><!--<a href="javascript:logOff()">Log Off</a>--><INPUT onclick=javascript:logOff() id=logoff type=button value="Log Off" name=logoff> </TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD align=center><FONT size=1>For assistance, contact the USC: 1-800-387-1833. </FONT></TD></TR>
<TR>
<TD align=center><FONT size=2><I>Version 2.0 &nbsp;&nbsp;&nbsp;February 2008 </I></FONT></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>


Here are a few regex codes that I have used but I just can't seem to get the right

This is is basically giving me all the information I need but I'm trying to get rid of the stuff after the names eg."PC, ESB, CR, CRO"
<TD>(\w.*?)<

This one does remove the lines with "PC" but it also removes the name.

<TD>(\w.*?)(?<!PC)<

My goal is basically to have vox TTS "First Out, Name, if on rest?what time?, Second Out, Name.." and down the list.

Maybe I am in over my head lol.

Any help greatly appreciated guys! Cheers!

nime5ter

Hi Oktane83,

We actually had some fun with this earlier this morning. It's not the easiest thing in the world, but hopefully what we came up with will get you started.

I don't have the xml in front of me right now, but I'll remind James to post it when he gets in.
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

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.1.9-->
<commandGroup open="True" name="I spy" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="290" name="check-check" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>staff.html</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExSingle</cmdType>
      <params>
        <param>color.*?&lt;td&gt;(\w.*?)(?:PC|CR|ESB|CR|CRO).*?&lt;/td&gt;\r\n&lt;td&gt;(\d\d)&lt;.*?&lt;td&gt;(.*?)&lt;/td&gt;</param>
        <param>|</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Found {#M} matches</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.MatchToEvent</cmdType>
      <params>
        <param>empStatus</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
  <command id="288" name="Announce who's on" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.SetLastResult</cmdType>
      <params>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>(\D.*?)\|0*(\d+?)\|(\d.*?|&amp;nbsp;)$</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Employee: {Match.1.1}</param>
        <param>3000</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>Position: {Match.1.2}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{Match.1.3}&amp;&amp;nbsp;</ifParams>
      <then>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Employee: {Match.1.1}, is in position:  {Match.1.2}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.AddText</cmdType>
          <params>
            <param>Rest: {Match.1.3}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <params>
            <param>with a rest at: {Match.1.3}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <params>
            <param>Employee: {Match.1.1}, is in position:  {Match.1.2}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <event>empStatus</event>
  </command>
</commandGroup>

nime5ter

Be sure to update to VC2 1.919 if you haven't yet (http://voxcommando.com/forum/index.php?topic=1443.0).

The xml James posted uses the new command structure.
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)

Oktane83

You guys are unbelievable!!  :hugs This is definitely going to help! Wow!  ::bow ::bow

Oktane83

Quick question. Actually 2. Do you have a paypal account so I can make a donation for your help? And number 2, when I switch the TTS voice from Hazel UK to any of the US voices it doesn't speak the date format or time properly. ei. "with a rest at 14 dash 03 dash..." and "14 colon 05" Any way to fix that?

Thanks again!

jitterjames

Thanks.  Yes, well, that is a bit of a weird question.  If you have purchased a license for VoxCommando then you should know that we have a PayPal account.  :)  At the bottom of the purchase page there is also a donate button. http://voxcommando.com/buynow.asp

It's true, different TTS voices will interpret dates, numbers etc. in different ways.  Dates of course can be formatted in about 20 different ways depending on what country you are in.  If a particular TTS voice is not able to recognize the format you have then you will need to adjust it, either by modifying your regex somehow, or possibly by doing some kind of replace.

Oktane83

Just found out about VC about 1 week ago and was trialing the software. I got so caught up in it's awesomeness man! Just take my money! lol

Weird thing is the time though. I don't know many ways to write 10:30 and when I put 10:30 into the TTS preview in reads fine! Stumped.  ::hmm


jitterjames

What TTS voice / engine are you using?  A particular TTS voice will almost certainly read the same thing the same way every time.  If it reads it differently one time, it will probably be because it is written differently.  In your case you need to separate the time from the date with a space.  I see in your other thread you seem to have figured this out but I'm mentioning it here for anyone following this thread.

Bleazle

Hi James

I'm using VC 1.9.2.2 and have just tried getting RoboB to load www.iheart.com but I got this message: http://www.iheart.com/help/not-supported/

I'm not too worried but I thought you might want to know.

Cheers

Dave


jitterjames

Oh well.  So it goes. I'm sure it is not the only site!