News:

There is a soft-mute function which we use with the commands like "What song is this?" There is one for system volume, one for each of: MediaMonkey, XBMC, iTunes, MediaPortal.

Main Menu

Variable looping

Started by OklahomaGreyBeard, May 11, 2015, 11:51:56 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

OklahomaGreyBeard

I've tried playing with the add loop function in CB and I don't know if I'm not understanding it, or if I'm using it for the wrong thing.  What I need is in my home cooling RoboB session, it can tell me what the current setting is. What I'd like to be able to do is say "set the room temperature to 72" it then looks to see it's currently at 80, does the math and clicks the down button 8 times then clicks submit. I can do everything including figuring out how many times to click the button (and the correct button depending on if it needs to go up or down) but it's setting the amount of time it clicks I can't seem to get.

nime5ter

#1
The method to use for this will depend on your whole command structure, so it would be easier to help if we could see your command xml (almost always true, btw).

But here is a generic example of how the loop block works:

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.6-->
<command id="678" name="Loop demo" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <params>
      <param>{Rnd.1.10}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>I will now loop {LastResult} times:</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <loop>
    <loopParams>
      <from>1</from>
      <to>{LastResult}</to>
    </loopParams>
    <loopActions>
      <action>
        <cmdType>OSD.AddText</cmdType>
        <params>
          <param>{j}. hi</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </loopActions>
  </loop>
  <phrase>Loop demo</phrase>
</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)

OklahomaGreyBeard

Absolutely perfect. I did not know that you could use a variable in the Loop Over Range action. (checked the WIKI and it says coming soon  :D )

Once I have this all down, I plan on posting the command set so others that may have this same Honeywell thermostat cloud issue can insert their own login and password and control it. My only remaining issue now is the login timeout problem in the other thread.

nime5ter

Quote from: OklahomaGreyBeard on May 11, 2015, 12:27:46 PM
Absolutely perfect. I did not know that you could use a variable in the Loop Over Range action. (checked the WIKI and it says coming soon  :D )


Thanks for mentioning the missing documentation. This has now been addressed.

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

links to:

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

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)