"If" statement help

bitzerjd's Avatar Topic Author
User User
  • Posts: 375
  • Thanks: 3

"If" statement help

2 years 6 months ago
#1822
I know this is super simple, but it's not for me....  What is the correct syntax for a If, Then, Else Macro (or command).

If
Variable X = 0
then
AV|14.........
else
AV14,,,,,,,

I know how to set variables and call commands, just not sure on the correct syntax for the If statement.

Thanks in advance!

Please Log in or Create an account to join the conversation.

David Li's Avatar
Admin Admin
  • Posts: 1027
  • Thanks: 99

Re: "If" statement help

2 years 6 months ago
#1824
allonis.com/support/documentation?view=category&id=247
There is an example in that article.
That article needs a lot of updating and cleaning up but has most all of the basics.

Please Log in or Create an account to join the conversation.

bitzerjd's Avatar Topic Author
User User
  • Posts: 375
  • Thanks: 3

Re: "If" statement help

2 years 6 months ago
#1825
Like this?

if|isequal##{{active_tivo}}##{{11}}##{{AV|{{active_tivo}}~Tivo##{{AV|{{active_tivo}}~Main

Check if the active tivo is 11 and if it is run the Tivo command and if not run the Main command.

Thanks for the link!

Please Log in or Create an account to join the conversation.

davep's Avatar
Admin Admin
  • Posts: 371
  • Thanks: 98

Re: "If" statement help

2 years 6 months ago - 2 years 6 months ago
#1827
No, only put the server variables in curly braces.

if|isequal##{{active_tivo}}##11##AV|{{active_tivo}}~Tivo##AV|{{active_tivo}}~Main

The Tivo driver has a command AV|<id>~Tivo   but not a AV|<id>~Main command. Is Main a valid Tivo command? If so I'll add it in the driver.
Last edit: 2 years 6 months ago by davep.

Please Log in or Create an account to join the conversation.

bitzerjd's Avatar Topic Author
User User
  • Posts: 375
  • Thanks: 3

Re: "If" statement help

2 years 6 months ago
#1829
Thanks!!!

"Main" was a mistype ...no action required.

Now I can go and implement my logic!

Please Log in or Create an account to join the conversation.

bitzerjd's Avatar Topic Author
User User
  • Posts: 375
  • Thanks: 3

Re: "If" statement help

2 years 5 months ago
#2129
I saw this example in your docs.

If|isEQ##{{variable_x}}{{variable_y}}##onoff##do something interesting

In the example variable_x = on and variable_y=off   

How does it know to parse ##onoff##  Shouldn't there be a delimiter between the values?  In my case the variables are 0 and 1 so it would be some combo of that. 00, 01,10 etc.

Thanks!



 

Please Log in or Create an account to join the conversation.

Time to create page: 0.271 seconds