News:

HOT TIP! Commands and groups can be copied and pasted directly from your command editor to the forum, and vice versa. This makes sharing command XML on the forum much easier!

Main Menu

Scrape Fail causes VC.SetEventTimmer to repeat

Started by PegLegTV, March 19, 2016, 02:36:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PegLegTV

I was trying to use VC.SetEventTimmer to trigger an event to run a command that had a Scrape action in it and it worked a couple times and then it would start to trigger the event again and again causing the command to repeated until I would force close VC,

after some testing I found that it happens if the first Scrape action fails, I know this seems confusing partially because its so bizarre and because its hard to explain  :bonk

so I created a group that you can run to see what I mean

in the second command there are two scrape actions the first one I set to a "fake" IP address so it would fail
the second IP is for my beam (you can change that IP address to your beam IP so they don't fail)

I also added an on screen counter to show how many times it repeats
I also added in VC.StopMacro so it should stop repeating after 3 times (it can still take VC about a minute to Respond after "3" is show on the OSD as it still needs to finish executing the command)

just execute the command called "Execute ME" this will set an event timer for 10 seconds to trigger the second command

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.6-->
<commandGroup open="True" name="Scrape Fail causes Repeat" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="443" name="Execute ME" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.SetEventTimer</cmdType>
      <params>
        <param>10S</param>
        <param>Scrape</param>
        <param>1</param>
        <param>10</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>ScrapeRe</param>
        <param>0</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
  <command id="1361" name="Scrape" 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>2&amp;&amp;{Var.ScrapeRe}</ifParams>
      <then>
        <action>
          <cmdType>VC.StopMacro</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <action>
      <cmdType>PY.ExecString</cmdType>
      <params>
        <param>result={Var.ScrapeRe}+1</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <params>
        <param>ScrapeRe</param>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>{Var.ScrapeRe}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Scrape</cmdType>
      <params>
        <param>http://192.168.1.202/sendIR?p=NEC&amp;code=0x20df40bf</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Scrape</cmdType>
      <params>
        <param>http://192.168.1.201/sendIR?p=NEC&amp;code=0x20df40bf</param>
      </params>
      <cmdRepeat>{2}</cmdRepeat>
    </action>
    <event>Scrape</event>
  </command>
</commandGroup>


running 2.2.1.6

Edit: If you want my log file let me know and I will PM it to you

jitterjames

Looks like a bug and I'll look into it.

I have to say though, I really can't figure out the purpose of this command or why you are doing it like this.  If you can explain what you are trying to do I'm sure I can offer a workaround.  Or maybe this is just something you came up with to demonstrate the bug.

PegLegTV

this is just what I came up with to show how it was repeating, I think I have a couple ideas on how to get around it with my actual command.

jitterjames

I'm pretty sure I can fix it in the next release but what is happening is this:

When the event timer goes off, it will execute the command and then destroy the timer.  If the command takes more than ten seconds to complete then the timer goes off again before it gets killed because timers loop by default.

The fix will be to change it so the timer is stopped first, then the command(s) execute, and then the timer object is destroyed.

I'm actually surprised that this problem has not come up before with shorter timers, but I guess most of the time the duration of the timer is less than the time a command takes to execute.

In the example you show I don't see why you need a timer at all, but anyway, I'll leave it up to you to find a solution.

PegLegTV

#4
I found it when creating a command for shutting down my living room and turning on my bedroom equipment,

I have it turn on my bedroom TV, launch Pandoki and then adjust the volume with scrape,

and because it's a Fire stick (in my bedroom) I have to have VoxCommando on my main PC do everything and if I had all that happen with a normal VC.TriggerEvent then it would take an extra 20 to 30 seconds for my living room stuff to shut down, (the down side of using a fire stick over another PC Running VC)


I added a VC.StopEventTimer to the begging of my command that has the scrape action and that fixed it   :D