Author Topic: Scrape Fail causes VC.SetEventTimmer to repeat  (Read 2096 times)

0 Members and 1 Guest are viewing this topic.

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Scrape Fail causes VC.SetEventTimmer to repeat
« on: March 19, 2016, 02:36:49 AM »
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

Code: [Select]
<?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
« Last Edit: March 19, 2016, 03:54:49 AM by PegLegTV »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Scrape Fail causes VC.SetEventTimmer to repeat
« Reply #1 on: March 19, 2016, 09:54:34 AM »
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

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Scrape Fail causes VC.SetEventTimmer to repeat
« Reply #2 on: March 19, 2016, 11:34:51 AM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Scrape Fail causes VC.SetEventTimmer to repeat
« Reply #3 on: March 19, 2016, 11:54:10 AM »
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

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Scrape Fail causes VC.SetEventTimmer to repeat
« Reply #4 on: March 19, 2016, 12:19:25 PM »
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

« Last Edit: March 19, 2016, 01:53:59 PM by jitterjames »