Your Universal Remote Control Center
RemoteCentral.com
Complete Control by URC Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Primer on IF/ELSE?
This thread has 7 replies. Displaying all posts.
Post 1 made on Sunday January 11, 2009 at 22:58
jacobp
Founding Member
Joined:
Posts:
January 2002
11
I have a MX-980 and would like to learn how to program IF/ELSE statements and some practical applications for their use. Thanks.
Post 2 made on Sunday January 11, 2009 at 23:30
smokinghot
Super Member
Joined:
Posts:
August 2006
3,688
Could you mention what searches you've done within the forum already. I just don't want to repeat the stuff you've already read on the topic. Different aspects have already been discussed, multiple times.

Thanks

;)
....Light travels faster than sound. That's why some people appear bright until you hear them speak.
Post 3 made on Monday January 12, 2009 at 00:40
Loraquest
Long Time Member
Joined:
Posts:
June 2002
345
Off the top of my head, one of the most common uses of IF/ELSE statements would be for press-and-hold macros. For example:

IF Press Time < 2 Seconds ... do this
ELSE ... do that
Post 4 made on Monday January 12, 2009 at 22:35
shepdawg7
Advanced Member
Joined:
Posts:
June 2008
767
I also use them in conjunction with UI variables, especially power states of components. Example:

IF [UI Variable (TV Power), False]
TV Power On
Delay 3.0s
TV/ Video 1
ELSE
TV/ Video 1

In this case, when the TV (a projector would be a better example) is already on, the macro that selects a different video source skips the delay required between the power on command and an inpus selection command.

Another way I use variables is pretty neat, I think. I use my MX-980 to control my main theater plus a second zone (patio). When I'm listening to, say, XM on the patio, I may or may not also be listening to XM in the theater. So, I have a macro to turn the patio off that includes an IF/ELSE statement concerning the power state of the main zone (theater). When I turn off the patio, I want the XM tuner to turn off too, but only if the main zone's amp power is not on. Likewise, my main power off command in the theater checks to see if I'm listening on the patio to determine whether to turn off the XM tuner or leave it on. I simply turn off both zones to ensure that everything gets turned off
Chris
OP | Post 5 made on Monday January 12, 2009 at 22:57
jacobp
Founding Member
Joined:
Posts:
January 2002
11
On January 12, 2009 at 00:40, Loraquest said...
Off the top of my head, one of the most common uses of
IF/ELSE statements would be for press-and-hold macros.
For example:

IF Press Time < 2 Seconds ... do this
ELSE ... do that

Now I really feel stupid. What is the benefit of Press & Hold if you can program a macro (MX980) to turn on, for example, DirecTV, by just pressing the DirecTV button on the watch screen.
Post 6 made on Monday January 12, 2009 at 23:14
Daniel Tonks
Wrangler of Remotes
Joined:
Posts:
October 1998
28,766
Press-and-hold has always been for optional macros (that you may not want sent every time the button is pushed) or for when you want to double-stack commands on buttons.

If/Else is typically for working with device states. For example, "if the projector is already on, don't make the user wait 30 seconds for it to warm up before they can do something".
Post 7 made on Tuesday January 13, 2009 at 01:50
Loraquest
Long Time Member
Joined:
Posts:
June 2002
345
On January 12, 2009 at 23:14, Daniel Tonks said...
Press-and-hold has always been for optional macros (that
you may not want sent every time the button is pushed) ...

Here's an example. You can program it so that when you press the "OFF" button, it turns off the currently selected device, but If you hold the "OFF" button down for a specified period of time, it initiates a "System Off" macro and shuts down the whole system.

On January 12, 2009 at 22:57, jacobp said...
What is the benefit of Press
& Hold if you can program a macro (MX980) to turn on,
for example, DirecTV, by just pressing the DirecTV button
on the watch screen.

Actually, many people like to use press-and-hold macros on the main device buttons. For example, a brief button press will trigger the appropriate macro, whereas an extended button press will simply jump to the device page. This allows you to navigate straight to a device without firing the macro, and it can come in handy if you want to adjust some settings but you don't necessarily want to change inputs. This type of programming ensures that the remote is easy for any random person to use, and yet it still allows the power user to easily tweak stuff.
Post 8 made on Tuesday January 13, 2009 at 08:31
Bubby
Advanced Member
Joined:
Posts:
July 2007
942
On January 12, 2009 at 22:35, shepdawg7 said...
I also use them in conjunction with UI variables, especially
power states of components. Example:

IF [UI Variable (TV Power), False]
TV Power On
Delay 3.0s
TV/ Video 1
ELSE
TV/ Video 1

I do something similar, but I tend to not use the ELSE statements. I would move the TV/Video 1 statement out of the IF/ELSE make it part of the rest of the macro as it is going to be fired no matter what the outcome of the IF statement. It would look like this:

Page Jump, Wait Page 1
IF [UI Variable (TV Power), False]
TV Power On
Delay 3.0s
ELSE
--------------------------

TV/ Video 1
Page Jump, TV Page 1

I just leave the ELSE statement blank. So if the TV Power is false, the TV powers on and waits 3 sec. If the TV Power is true, nothing happens and the next step of the macro is run which is the TV Input. This makes it easier to embed multiple IF/ELSE in a macro. Mine would actually look more like:

Page Jump, Wait Page 1
IF [UI Variable (TV Power), False]
TV Power On
Delay 3.0s
ELSE

--------------------------
IF [UI Variable (TV Video1), False]
TV Video 1
ELSE
--------------------------

Page Jump, TV Page 1

This keeps the Video 1 command from being sent if it is not needed. Granted, things can get off kilter here but the OFF button will reset all variables.

Just the way I do it. It could be wrong.


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse