Author Topic: Speak future Google Calender events?  (Read 1992 times)

0 Members and 1 Guest are viewing this topic.

the1Dmitri

  • Jr. Member
  • **
  • Posts: 13
  • Karma: 2
    • View Profile
Speak future Google Calender events?
« on: December 25, 2015, 10:22:54 AM »
Sorry if this was asked already elsewhere. But is there a way to set VC to read off calendar events? For example. I would like to be able to say "What time do I work tomorrow" And have VC respond back with the time I work based on what I added to my Google calendar. Thanks for the help.

And this is one awesome app and well worth the price :)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Speak future Google Calender events?
« Reply #1 on: December 25, 2015, 01:23:46 PM »
Yes, it's a little bit complicated currently, to ask the kind of question you want to ask of Google Calendar. I think James would like to develop the plugin further, when he has time. But there is a long list of things to do in VoxCommando's development. :)

We're glad you're having fun with the program.

Below I provide three example commands. I'm sorry, I don't have time to explain everything right now. But maybe you can play with it to try to understand how it works.

You will need to also download the attached payload XML file, which I use in 2 of the commands.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.3-->
<commandGroup open="True" name="Google Calendar examples" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="139" name="What's on my agenda {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Each event for that day is returns as a match: {Match.1}, {Match.1} etc. Currently will use your default calendar feed.">
    <action>
      <cmdType>GgCal.GetDay</cmdType>
      <params>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>You schedule {PF.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>{Match.{i}}</param>
      </params>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
    <phrase>What's on my agenda</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\Google days.xml</payloadFromXML>
  </command>
  <command id="135" name="What time do I {1} {2}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>GgCal.GetDay</cmdType>
      <params>
        <param>{2}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.MatchConcat</cmdType>
      <params>
        <param>{CR}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param><![CDATA[ ]]></param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>(\w.*?{1})</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)&lt;(B)</ifType>
      <ifParams>0&amp;&amp;{#M}</ifParams>
      <then>
        <action>
          <cmdType>Results.RegEx</cmdType>
          <params>
            <param>(\d.+)\:{1}</param>
            <param />
            <param>{Match.1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>You are scheduled to {1} {PF.2} at: {Match.1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>I'm sorry, I do not see {1} scheduled {PF.2}.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>What time do I</phrase>
    <payloadList>work, practice football, pick up the kids</payloadList>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\Google days.xml</payloadFromXML>
  </command>
  <command id="153" name="When do I next {1}?" 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.RegExReplace</cmdType>
      <params>
        <param><![CDATA[ ]]></param>
        <param>\s</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>event</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>GgCal.GetRange</cmdType>
      <params>
        <param>0</param>
        <param>6</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.MatchConcat</cmdType>
      <params>
        <param>{CR}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>(\w.*?{var.event})</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)&lt;(B)</ifType>
      <ifParams>0&amp;&amp;{#M}</ifParams>
      <then>
        <action>
          <cmdType>Results.RegEx</cmdType>
          <params>
            <param>(\w.+)\:.{var.event}</param>
            <param />
            <param>{Match.1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>{1} is next scheduled: {Match.1}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <params>
            <param>I'm sorry, I do not see {1} scheduled.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>When am I next scheduled to</phrase>
    <payloadList>work, practice football, pick up the kids</payloadList>
  </command>
</commandGroup>

Command 1, "What's on my agenda {today/tomorrow/in 2 days}" is the simplest.

For the other 2 commmands, you can provide a payload list of specific event names you want to search for. In my example, I use 3: work, football practice, pick up the kids.

If you only want to ask about "work", that would be quite a bit simpler. :)

The payload xml file, "Google days" is required to associate friendly terms with an index value that Google requires when you ask for a specific day. Today is 0, tomorrow is 1, etc.

A more sophisticated and versatile solution for the day of the week problem is possible, if you use our Python plugin. (See http://voxcommando.com/forum/index.php?topic=1755.0 for a similar example.) But for now, I recommend experimenting with the command examples here.

Note: Right now, it will use the calendar feed you have set up as the default. If you want to use a different feed, there is an optional parameter in the GgCal actions where you can provide the name of the feed.

We will be "out of the office" for the next 24 hours or so, but let us know if you have any questions.

« Last Edit: December 26, 2015, 09:38:53 AM by jitterjames »
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: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Speak future Google Calender events?
« Reply #2 on: December 25, 2015, 01:26:02 PM »
Tip: some of the extra actions in the two commands that use regular expressions are because of the way that regular expressions handle spaces between words.

I am stripping spaces so that we can match patterns when the event name is more than one word. There are several ways this could be solved, though.
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)

the1Dmitri

  • Jr. Member
  • **
  • Posts: 13
  • Karma: 2
    • View Profile
Re: Speak future Google Calender events?
« Reply #3 on: December 25, 2015, 02:40:12 PM »
Awesome. Thanks a lot nime5ter. I love the seamlessly endless possibilities of this program.