Author Topic: Integrating windows task scheduler with VC for reminders and events  (Read 5624 times)

0 Members and 1 Guest are viewing this topic.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
windows task scheduler is a very powerful part of windows and it can be integrated with VC to create reminders and events that trigger various actions without polling.

tasks can be added to WTS with command line and the task shouldn't be very hard ... here is a reference http://technet.microsoft.com/en-ca/library/cc772785(v=ws.10).aspx#BKMK_create

VC tasks can be stored in a VC folder ...

command can be
remind me at (time) on (date) to (do something)
create an event (event name) at (time) on (date)
create an event (event name) every day at (time)
create an event (event name) every day at (time) on (date)
etc.

delete commands
and modify ...

if anybody feeling to get hands dirty will be great ... on my side it is on agenda but not very soon ...

or even this can be converted into a plugin which would make life much easier
« Last Edit: April 12, 2016, 04:51:56 AM by Haddood »
When Voice command gets tough, use hand gestures

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Integrating windows task schedueler with VC for remiders and events
« Reply #1 on: October 05, 2014, 02:12:45 AM »
Had some time today and I decided to work on this a bit... here is the core function that creates the WTS new task ...
it should be called by commands to create reminders, alarms and other schedules ...

it takes 4 payloads .... (see description in the command)  to test it see the second command ...
Sub folders can be created by passing them along with task name in payload 1

{1} = alarms\alarm 1 will create subfolder called alarms and create a task called alarm 1

Edit: Command has been revised, changed the sequence of payloads passed to tsksch.exe in order to make payload(s) passed with VC event optional (if no payload specified to be passed with VC event, event will trigger with payload 1 = nill) ... reset lastresult to avoid reporting false success.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.0.3-->
<command id="604" name="Create Windows Task" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="All tasks will be created in iHome\VC&#xD;&#xA;{1} Windows Task Name &#xD;&#xA;{2} schedule  ( ex: weekly /d WED see http://technet.microsoft.com/en-ca/library/cc772785(v=ws.10).aspx#BKMK_create)&#xD;&#xA;{3} VC event name &#xD;&#xA;{4} payload(s) to pass (multiple payload must be passed as one string, &amp; signs must be quoted like in PL 1&quot;&amp;&quot;&quot;&amp;&quot;PL 2)  - optional&#xD;&#xA;">
  <action>
    <cmdType>Launch.Capture</cmdType>
    <params>
      <param>C:\Windows\System32\schtasks.exe</param>
      <param>/create /tn "\iHome\VC\{1}" /sc {2} /tr "\"{Path.VC}\VoxCommando.exe\" -33000 \"VC.TriggerEvent"&amp;""&amp;"WTS.{3}"&amp;""&amp;"{4}\""</param>
      <param>True</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="True">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{LastResult}&amp;&amp;SUCCESS</ifParams>
    <then>
      <action>
        <cmdType>VcAdvanced.Log</cmdType>
        <params>
          <param>task creation failed</param>
          <param>{LastResult}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>VcAdvanced.Log</cmdType>
        <params>
          <param>Success</param>
          <param>{LastResult}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>WTS.Create</event>
</command>

----------------------------- command to test task creation ( LCB allow 3 payloads and command need 4) -----------------------------

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.0.3-->
<command id="629" name="test task create" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>VC.TriggerEvent</cmdType>
    <params>
      <param>WTS.Create</param>
      <param>Alarm\6</param>
      <param>weekly /d WED</param>
      <param>Alarm</param>
      <param>PL 1"&amp;""&amp;"PL 2</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>
« Last Edit: October 08, 2014, 06:15:17 AM by Haddood »
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Integrating windows task scheduler with VC for remiders and events
« Reply #2 on: October 05, 2014, 08:46:37 AM »
To add more parameters to an action just use the parameter helper.

http://voxcommando.com/mediawiki/index.php?title=Parameter_Helper

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Integrating windows task scheduler with VC for remiders and events
« Reply #3 on: October 05, 2014, 08:53:12 AM »
Works great. Thanks Hadood!  :hugs

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Integrating windows task scheduler with VC for reminders and events
« Reply #4 on: October 08, 2014, 06:07:50 AM »
here is the first application for windows task scheduler ... needs the revised command in post 1

it is a command that sets an alarm event by saying: set an alarm at time or wake me up at time ... time can be 12/24h format or even military   8) 8) - if am/pm not specified 9 will mean 9:00 am
(not if you use military it will set the event correctly but the feedback -TTS- won't say hundred or hour)...

replace trigger feedback with TTS or anything else as you see fit ...

the command will not produce the alarm sound. it will only set a task to trigger an event at the specified time ... create your own alarm sound command ... will be cool if someone do it with snooze function (let me sleep another 10 minutes)

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.0.3-->
<command id="670" name="Alarm" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)&lt;(B)</ifType>
    <ifParams>{1}&amp;&amp;10</ifParams>
    <then>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>hour</param>
          <param>0{1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>hour</param>
          <param>{1}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{2} {3}&amp;&amp;PM</ifParams>
    <then>
      <action>
        <cmdType>PY.ExecString</cmdType>
        <params>
          <param>result = {1} +12</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>hour</param>
          <param>{LastResult}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)==(B)</ifType>
    <ifParams>{#P}&amp;&amp;1</ifParams>
    <then>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>minute</param>
          <param>00</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>AM PM&amp;&amp;{2}</ifParams>
    <then>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>minute</param>
          <param>00</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)&lt;(B)</ifType>
    <ifParams>{2}&amp;&amp;10</ifParams>
    <then>
      <action>
        <cmdType>Results.SetVar</cmdType>
        <params>
          <param>minute</param>
          <param>0{2}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{LastSpoken}&amp;&amp;wake me up</ifParams>
    <then>
      <action>
        <cmdType>VC.TriggerEvent</cmdType>
        <params>
          <param>WTS.Create</param>
          <param>Alarm\Wakeup{DtCustom.MMddHHmm}</param>
          <param>once /st {Var.hour}:{Var.minute}</param>
          <param>Alarm</param>
          <param>alarm1.wav</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.TriggerEvent</cmdType>
        <params>
          <param>feedback </param>
          <param>I will make sure to wake you up at {1}:{2} {3}</param>
          <param>2</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>VC.TriggerEvent</cmdType>
        <params>
          <param>WTS.Create</param>
          <param>Alarm\alarm{DtCustom.MMddHHmm}</param>
          <param>once /st {Var.hour}:{Var.minute}</param>
          <param>Alarm</param>
          <param>alarm2.wav</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.TriggerEvent</cmdType>
        <params>
          <param>feedback </param>
          <param>I set up an alarm at {1}:{2} {3}</param>
          <param>2</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <phrase>set an alarm, wake me up</phrase>
  <phrase>at</phrase>
  <payloadRange>1,23</payloadRange>
  <phrase optional="true">O, hundred</phrase>
  <payloadRange optional="true">1,59</payloadRange>
  <phrase optional="true">o'clock, hour</phrase>
  <payloadList optional="true">AM, PM</payloadList>
</command>
« Last Edit: October 08, 2014, 06:30:01 AM by Haddood »
When Voice command gets tough, use hand gestures

outlaw

  • Jr. Member
  • **
  • Posts: 21
  • Karma: -1
    • View Profile
Re: Integrating windows task scheduler with VC for reminders and events
« Reply #5 on: July 25, 2015, 09:36:04 PM »
hi im still a newbie here  ;D but I have been trying to setup tts for this xml so vc will say what time it is setting the alarm for but no such luck. sorry but could someone maybe help with this issue?

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Integrating windows task scheduler with VC for reminders and events
« Reply #6 on: July 25, 2015, 10:01:30 PM »
What have you tried so far? If you post the xml for the command(s) you revised or tried to make without luck so far, it will be easier to assist.

« Last Edit: July 26, 2015, 03:21:12 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)

JonPeyton

  • $upporter
  • Jr. Member
  • *****
  • Posts: 36
  • Karma: 3
    • View Profile
Re: Integrating windows task scheduler with VC for reminders and events
« Reply #7 on: October 30, 2015, 08:19:27 PM »
works well thank you!