VoxCommando Forum

Help and Support (Using VoxCommando) => VoxCommando Basics and Core Features => Topic started by: xtermin8r on December 28, 2012, 08:09:08 PM

Title: Best method for long delays ?
Post by: xtermin8r on December 28, 2012, 08:09:08 PM
hola

I need a delay of 8 seconds between 2 commands. i have tried vc.pause, what other methods are there that do not freeze voxcommando ?
Title: Re: Best method for long delays ?
Post by: jitterjames on December 28, 2012, 09:31:03 PM
use VC.SetEventTimer

it works similar to VC.TriggerEvent but with a delay
Title: Re: Best method for long delays ?
Post by: xtermin8r on December 29, 2012, 08:29:01 AM
Quote from: jitterjames on December 28, 2012, 09:31:03 PM
use VC.SetEventTimer

it works similar to VC.TriggerEvent but with a delay

muchas gracias
Title: Re: Best method for long delays ?
Post by: xtermin8r on January 07, 2013, 01:37:13 PM
Problem with VC.SetEventTimer, doesn't seem to work, any ideas ?

[attachment=1]
Title: Re: Best method for long delays ?
Post by: Dave on January 07, 2013, 01:56:41 PM
vc.SetEventTimer triggers an event after a specific time, so you can't use it in exactly the same way like vc.pause.
take a look here:
http://voxcommando.com/mediawiki/index.php?title=Actions#SetEventTimer
Title: Re: Best method for long delays ?
Post by: xtermin8r on January 07, 2013, 02:13:55 PM
@Dave
thanks for the reply, the thing is i dont want to trigger another event, it means that i will need to trigger an event for every long delay i need , makes no sense.
Title: Re: Best method for long delays ?
Post by: jitterjames on January 07, 2013, 05:40:01 PM
It is what it is.  I think for your purposes you should be able to use either method, but the trigger event action is obviously for triggering events, and requires two parameters, not one.

You can also include a payload in your event to make it more versatile.  In this case the event could be "key press" and the payload could be the key.  In the command that is triggered by the event, you can use {1} to get the value of the key.
Title: Re: Best method for long delays ?
Post by: Dave on January 08, 2013, 07:02:36 AM
you could use logic blocks if you don't want to trigger 3 different events...
try this!
[attachment=1]



Title: Re: Best method for long delays ?
Post by: xtermin8r on January 08, 2013, 02:41:22 PM
Thanks Dave, i will give it a shot.
Title: Re: Best method for long delays ?
Post by: jitterjames on January 08, 2013, 05:06:13 PM
here is an alternative method:

<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="delayed keys" enabled="True" prefix="" priority="0" requiredProcess="" description="">
 <command id="823" name="first command" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
   <action>
     <cmdType>XBMC.ExecBuiltin</cmdType>
     <cmdString>playmed...</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>VC.SetEventTimer</cmdType>
     <cmdString>5&amp;&amp;presskeys&amp;&amp;a</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>VC.SetEventTimer</cmdType>
     <cmdString>10&amp;&amp;presskeys&amp;&amp;w</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
 </command>
 <command id="840" name="press keys" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
   <action>
     <cmdType>SendKeys</cmdType>
     <cmdString>{1}</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <event>presskeys</event>
 </command>
</commandGroup>
Title: Re: Best method for long delays ?
Post by: xtermin8r on January 08, 2013, 06:24:10 PM
@James

Your method  does not work properly. both VC.SetEventTimer are triggered together.
Title: Re: Best method for long delays ?
Post by: jitterjames on January 08, 2013, 06:42:48 PM
Weird.  I tested it here and it worked perfectly.  How did you implement it?  did you copy and paste or recreate it by hand?
Title: Re: Best method for long delays ?
Post by: xtermin8r on January 08, 2013, 06:53:03 PM
hi James
copy and paste.
Title: Re: Best method for long delays ?
Post by: jitterjames on January 08, 2013, 07:24:33 PM
I can't explain it.  Works exactly as expected on my system.

Can you send me your voicecommands.xml ?

here's the group again as an exported xml file, just in case...
Title: Re: Best method for long delays ?
Post by: jitterjames on January 08, 2013, 07:27:40 PM
 >:(

You may have copied and pasted, but then you ust have edited it, because I just looked at your image again, and you changed the delay of 10 seconds to a delay of 5, so both are delayed by 5 seconds, so that is why they both fire at the same time!  You just need to change the second one back to 10 seconds and it will work perfectly.
Title: Re: Best method for long delays ?
Post by: xtermin8r on January 08, 2013, 07:33:57 PM
hi everyone

After giving it some thought, I figured out why it did not work.

what must be done is  something like this
Scenario 1 : keys will be pressed 5 seconds apart.

VC.SetEventTimer 5 presskey a             after 5 seconds key a gets pressed
VC.SetEventTimer 10 presskey b           after another 5 seconds b gets pressed
VC.SetEventTimer 15 presskey c           after another 5 seconds key c gets pressed

NOT THIS
Scenario 2 : all keys will pressed consecutively after 5 seconds.

VC.SetEventTimer 5 presskey a
VC.SetEventTimer 5 presskey b
VC.SetEventTimer 5 presskey c

thanks to everyone who helped.