Author Topic: how to get vox to ad numbers to lines?  (Read 4431 times)

0 Members and 1 Guest are viewing this topic.

achel

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 4
    • View Profile
how to get vox to ad numbers to lines?
« on: February 07, 2015, 06:17:57 AM »
Hello

I am using  Skype to message vox with commands for reminders, I start my message with Rr and vox then knows it is a reminder. it then put it through the RegEx plug in to write reminders to a note pad I have got it to do this but I  would like it to number the lines it writes to notepad.

exsample

I text to vox:

Rr need milk
Rr phone mum
Rr jump rope

note pad then reads  at the moment

need milk
phone mum
jump rope

I would like it to read

1. need milk
2. phone mum
3. jump rope
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.3-->
<command id="566" name="newcommandname" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{3}&amp;&amp;Rr</ifParams>
    <then>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <params>
          <param>works</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>File.Write</cmdType>
        <params>
          <param>F:\voxcommando\vera\Memory\skype.txt</param>
          <param>{3}rr</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>File.Read</cmdType>
        <params>
          <param>F:\voxcommando\vera\Memory\skype.txt</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>RegExTool.Open</cmdType>
        <params>
          <param>{LastResult}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.RegEx</cmdType>
        <params>
          <param>Rr (.*?)rr</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>File.AppendLine</cmdType>
        <params>
          <param>F:\voxcommando\vera\Memory\skype2.txt</param>
          <param>{Match.1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType />
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <params>
          <param>nothing</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <event>allen on skype</event>
</command>

I would like this so I could say to vox reminder/task 1 is completed and then it would delete that line and then renumber them. I use not pad so I can say show me my reminders and vox will open note pad or say tell me and she reads it.

if this can be done any help wold be cool.

thanks allen

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: how to get vox to ad numbers to lines?
« Reply #1 on: February 07, 2015, 08:55:07 AM »
Maybe try something like the following:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.8-->
<commandGroup open="True" name="remind me to" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="578" name="add reminder" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.AppendLine</cmdType>
      <params>
        <param>skype.txt</param>
        <param>{3}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>allen on skype</event>
  </command>
  <command id="579" name="read reminder" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{1}&amp;&amp;True</ifParams>
      <then>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>The remaining reminders are:</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>The remaining reminders are:</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>You asked me to remind you to:</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Reminders:</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>skype.txt</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>(\w.*?)\r</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>{i}. {Match.{i}}</param>
      </params>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{i}. {Match.{i}}</param>
      </params>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>res{i}</param>
        <param>{Match.{i}}</param>
      </params>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
    <phrase>read my reminders</phrase>
    <event>reset</event>
  </command>
  <command id="580" name="delete reminder" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>skype.txt</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>{var.res{1}}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Write</cmdType>
      <params>
        <param>skype.txt</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>reset</param>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>delete reminder</phrase>
    <payloadRange>1,10</payloadRange>
  </command>
</commandGroup>

1 stores your new reminders (i.e. writes them to a text file)
2 reads out your reminders numerically, storing each reminder as a variable numbered 1 through ...
3. Deletes reminder # of your choosing and resets the reminder variables.

... The regex here is expecting 1 reminder per line of the file.
« Last Edit: February 08, 2015, 01:45:39 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)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: how to get vox to ad numbers to lines?
« Reply #2 on: February 07, 2015, 09:51:04 AM »
In case it's not self-evident: The above example simplifies the skype-event-based setting of a reminder.

If you need it to only add a skype-sent message to the Reminder file based on some kind of logic, I leave that to you.
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)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: how to get vox to ad numbers to lines?
« Reply #3 on: February 07, 2015, 04:20:24 PM »
Just for the heck of it, here's a video demo of the above suggested solution:

http://www.screencast.com/t/wMiXbbS0J

Maybe it's easier to understand what's happening.

Sorry for the poor audio quality; it was an improvised recording so I didn't bother to plug in a decent microphone.

----

... For the video I added a couple bells & whistles so that VC announces when the to-do list is empty and varies the dialogue more:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.8-->
<commandGroup open="True" name="remind me to" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="578" name="add reminder" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.AppendLine</cmdType>
      <params>
        <param>skype.txt</param>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>type event name here</event>
    <phrase>remember to, add reminder to, don't forget to</phrase>
    <payloadList>walk the dog, call mum, rule the world, rock the planet, eat breakfast, go to bed</payloadList>
  </command>
  <command id="579" name="read reminder" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>skype.txt</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>(\w.*?)\r</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)==(B)</ifType>
      <ifParams>{#M}&amp;&amp;0</ifParams>
      <then>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>You've nothing left on your to-do list.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>The to-do list is empty.|You have no reminders left.|Looks like you're all caught up.</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)==(B)</ifType>
      <ifParams>{1}&amp;&amp;True</ifParams>
      <then>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>The remaining reminders are:</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>The remaining reminders are:|You should still remember:|The following items are left to do</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>You asked me to remind you to:</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>Reminders:</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <if ifBlockDisabled="False" ifNot="True">
      <ifType>(A)==(B)</ifType>
      <ifParams>{#M}&amp;&amp;0</ifParams>
      <then>
        <action>
          <cmdType>OSD.AddText</cmdType>
          <params>
            <param>{i}. {Match.{i}}</param>
          </params>
          <cmdRepeat>{#M}</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>{i}. {Match.{i}}</param>
          </params>
          <cmdRepeat>{#M}</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.SetVar</cmdType>
          <params>
            <param>res{i}</param>
            <param>{Match.{i}}</param>
          </params>
          <cmdRepeat>{#M}</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <phrase>read my reminders</phrase>
    <event>reset</event>
  </command>
  <command id="580" name="delete reminder" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>skype.txt</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegExReplace</cmdType>
      <params>
        <param>{var.res{1}}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Write</cmdType>
      <params>
        <param>skype.txt</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <params>
        <param>reset</param>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>delete reminder</phrase>
    <payloadRange>1,10</payloadRange>
  </command>
</commandGroup>

[Cleaned-up xml, updated 9-Feb-2015 --> the original accidentally had some repeated logic in it. Don't think it affected the command. It was just residual mess from creating the commands.]

« Last Edit: March 14, 2015, 10:10:06 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)

achel

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 4
    • View Profile
Re: how to get vox to ad numbers to lines?
« Reply #4 on: February 07, 2015, 05:22:21 PM »
Wow this has made my night.
I'm at work at the moment with the video I dont have to wait
till I get home to see it in action.
when I get back I will add it to my system and let you know.

As always above and beyond helpful nime5ter thank somuch for your time.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: how to get vox to ad numbers to lines?
« Reply #5 on: February 07, 2015, 06:07:41 PM »
Well, adaptations will no doubt be required for your needs but hopefully it provides a starting point.

Glad you think it's useful.

(I don't think it's bullet-proof at the moment, but it's probably good enough!)
« Last Edit: February 07, 2015, 06:16: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)

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: how to get vox to ad numbers to lines?
« Reply #6 on: February 08, 2015, 03:02:56 AM »
Great demo ...

On the other hand,  I can't help but wondering if you forget to rule the world, what is gonna happen?
When Voice command gets tough, use hand gestures

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: how to get vox to ad numbers to lines?
« Reply #7 on: February 08, 2015, 08:07:00 AM »
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: how to get vox to ad numbers to lines?
« Reply #8 on: February 08, 2015, 11:28:40 AM »
On the other hand,  I can't help but wondering if you forget to rule the world, what is gonna happen?

Next weekend. It's either that or  learn French...



achel

  • Jr. Member
  • **
  • Posts: 39
  • Karma: 4
    • View Profile
Re: how to get vox to ad numbers to lines?
« Reply #9 on: February 08, 2015, 12:39:15 PM »
Hmm my to do list.
Quote
need milk.
phone mum.
jump rope.

and nime5ter's to do list.
Quote
Rule the world.
Eat breakfast.
Call Mum.
Walk the dog.

The thing that comes to mind is my teachers saying "Allen, you must try harder" ;D.

Thanks again, I have got it all plugged in and up and running.

I'll wait till next week for how to get vox to teach me French Nime5ter

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: how to get vox to ad numbers to lines?
« Reply #10 on: February 08, 2015, 03:18:52 PM »
Next weekend. It's either that or  learn French...

 :clap  :clap  :clap

However, I am not sure if applauding is coming from my own will or my brain has been washed by video embedded messages !!!

And I got the reminders, I prefer to call it to do list (since it does not have an alert) up and running

will this be the new world anthem ?
« Last Edit: February 08, 2015, 03:48:21 PM by Haddood »
When Voice command gets tough, use hand gestures

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: how to get vox to ad numbers to lines?
« Reply #11 on: February 08, 2015, 03:25:45 PM »
And I got the reminders, I prefer to call it to do list (since it does not have an alert) up and running

Agreed, it is more of a "to-do" list.  :) I think the purpose is simply different.

PegLeg's version of this with event timers is more of a reminder scenario. http://voxcommando.com/forum/index.php?topic=1943.msg16729 .

(I use the GgCal plugin for the same purpose.)

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)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: how to get vox to ad numbers to lines?
« Reply #12 on: February 08, 2015, 04:26:49 PM »
And now back to our regularly scheduled programming ...


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)