News:

VoxCommando supports plugins for a wide variety of programs and devices. Contact us if you want to create your own.

Main Menu

Need help with logic

Started by Mirac78, June 29, 2014, 09:40:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mirac78

I try to make logic with short time to execute some commands if time is higher then 19:00 but can't make it right.

So what i do.. If NOT (A)<(B),  A is {ShortTime} and B is 19:00 then "do my command"

I try with LastResult and always get message in VC "Can't evaluate. Not a number".

Know is the simple thing but i get confused  :o

nime5ter

#1
Unfortunately, the time variables are not interpreted as numbers because of the : in the middle, so you can't directly use < / > logic on them. One option is to use regex.

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.5.6-->
<command id="269" name="Playing with time" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
 <action>
   <cmdType>Results.RegEx</cmdType>
   <params>
     <param>(\d*):(\d*)</param>
     <param />
     <param>{ShortTime}</param>
   </params>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <if ifBlockDisabled="False" ifNot="False">
   <ifType>(A)&lt;(B)</ifType>
   <ifParams>1900&amp;&amp;{Match.1}</ifParams>
   <then>
     <action>
       <cmdType>OSD.ShowText</cmdType>
       <params>
         <param>The time is later than 19:00.</param>
       </params>
       <cmdRepeat>1</cmdRepeat>
     </action>
   </then>
   <else>
     <action>
       <cmdType>OSD.ShowText</cmdType>
       <params>
         <param>It is still too early.</param>
       </params>
       <cmdRepeat>1</cmdRepeat>
     </action>
   </else>
 </if>
</command>


Another option would be to use Python.
* Not shown here...

The third option is to use a custom time variable rather than {ShortTime} (http://voxcommando.com/mediawiki/index.php?title=Variables).

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.5.6-->
<command id="280" name="Playing with time" 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>1930&amp;&amp;{DtCustom.HHmm}</ifParams>
   <then>
     <action>
       <cmdType>OSD.ShowText</cmdType>
       <params>
         <param>The time is later than 19:30.</param>
       </params>
       <cmdRepeat>1</cmdRepeat>
     </action>
   </then>
   <else>
     <action>
       <cmdType>OSD.ShowText</cmdType>
       <params>
         <param>It is still too early.</param>
       </params>
       <cmdRepeat>1</cmdRepeat>
     </action>
   </else>
 </if>
</command>

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)

Mirac78

TNX nime5ter, using first option and it's work great!

M.

jitterjames

For what it's worth I think the third option makes the most sense.