Page 1 of 1

Dynamic Action/Commands

Posted: Thu Nov 22, 2012 5:12 pm
by d_hero
Another day, another question!

I want to be able to have "activity" buttons that turn on for example sky box, tv, amp etc, but as not all of my devices have discrete on/off codes, therefore if I start "Sky" and then I want to move to "Blu Ray" without turning sky off (as i can do now with my harmony), what i have to do is create a different button for Blu ray than what is on the home screen, in order to use that button within the "Sky" activity. this is so it can have a different set of commands such as not having a TV power on command, because my TV uses a power toggle, so sending that command again (if i were to use a copy of the main button from the home screen) would result in some devices being on and some being off.

Is there anyway to dynamically assign commands to a button depending on what else is going on in the app, to avoid having to create multiple versions of the same buttons to use at various places in the app? Alternatively, is there a way of configuring demopad to keep a memory of the "state" of devices, so It knows not to send a power command to a device if it is already on?

Complicated I know but hope it makes sense

Re: Dynamic Action/Commands

Posted: Thu Nov 22, 2012 6:09 pm
by limeyb**tard
I usually assign multiple commands to the same button and then lock out each command with an appropriate activity flag, eg. watching blu-ray, watching xbmc etc. It is the easiest way I have found so far but would be interested to hear of a better way.

Re: Dynamic Action/Commands

Posted: Thu Nov 22, 2012 6:19 pm
by d_hero
Yeah the way I have done it so far, is like so:

1) Select Sky Activity
2) Demopad Turns on TV, Sky, Amp, Sets TV and Amp to correct input
3) Demopad Sets a flag to ON for each device "IsTVON", "IsAmpOn", "IsSkyOn" - Therefore the tasks in step 2 above are actually dependant on these flags being off to being with.
4) If i want to switch to Media Centre, I press Media button, which does the same as step 2 but turns off any device no related to media centre (have to manually send individual commands for each device), and then sends ON commands to the TV, Media Box, and Amp, but these ON commands are dependant on the IsTVOn flags from above, so it will only execute the command on a device where the On flag is set to off.

It sounds really confusing to read but i think it will work this way, I just get weary about having too many command son one button. Currently I have 12 on the Sky activity button and I only have 4 devices in total so if I had more, there would be many more commands on a single button. Is that ok?

Re: Dynamic Action/Commands

Posted: Thu Nov 22, 2012 6:27 pm
by DemoPad
One nice trick for situations like this is to use Numbers to recall stored macros...create a number called 'MACROS' (or whatever), and have it go from 0-100 (say). Set up a condition for if the number goes between 1 & 1, and put in a set of actions. Set up another condition if the number is between 2 & 2, and put in some more commands etc.

You can now execute that list of commands simply by setting the number to 1, or 2. That way you can start a pre-defined action list, dependent on a single flag, with a single action - which makes the button actions easier to manage. Within the stored macro, commands can still be executed dependent on a flag, so you effectively have an 'AND' gate as well if you want...

But to answer your question, yes you can have many actions on a single button...it is just not pretty to look at & debug!

Re: Dynamic Action/Commands

Posted: Thu Nov 22, 2012 6:31 pm
by limeyb**tard
I have multiple commands on a single button. I try to separate them in time so as not to overload the iTach but for setting flags I set them all Off/On in a group (select the folder rather than the individual flag) and then set the individual one back to On/Off, eg for XBMC I have flags for the playback speed and there are 9 of them in total, I set all 9 to Off in a single command and then set the appropriate one back to On 0.01 sec later. It may not save time but it makes the code easier to follow.