Author |
|
ficklma1 Groupie
Joined: December 08 2007 Location: United States
Online Status: Offline Posts: 59
|
Posted: December 27 2007 at 23:08 | IP Logged
|
|
|
Please excuse my ignorance here
What am I doing wrong with this macro?
10 FORMULA if("[LOCAL7]" = "DINING3",
if("[LOCAL10]" = "0",
ph_run('C:\Program Files\xlobby\XReceive\xsend.exe ~~"command:xlobby:button state set:drlamps_toggle:Off~~"'),
ph_run('C:\Program Files\xlobby\XReceive\xsend.exe ~~"command:xlobby:button state set:drlamps_toggle:On~~"')))
I've been able to get one if to work, but when I add the nested if here: if("[LOCAL7]" = "DINING3", if("[LOCAL10]" = "0", true part, false part, etc.
It doesn't seem to do anything.
Also,
What's the correct macro type when trying to nest if statements? Jump, Formula, etc.
I've been trying to understand the "Jump" type, could someone explain this as well.
Please help.
Thanks
Edited by ficklma1 - December 27 2007 at 23:08
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: December 28 2007 at 08:02 | IP Logged
|
|
|
Unless the board chopped it off, I think you are just missing a comma. Try this...
Code:
10 FORMULA if("[LOCAL7]" = "DINING3", if("[LOCAL10]" = "0", ph_run('C:\Program Files\xlobby\XReceive\xsend.exe ~~"command:xlobby:button state set:drlamps_toggle:Off~~"'), ph_run('C:\Program Files\xlobby\XReceive\xsend.exe ~~"command:xlobby:button state set:drlamps_toggle:On~~"')), "") |
|
|
For this, use a type of Formula.
JUMP transfers execution to the nth line after that one.
Example:
Code:
JUMP if([LOCAL1]=0, 1, 3)
USER MESSAGE "Jumped 1"
JUMP 999
USER MESSAGE "Jumped 3" |
|
|
A JUMP value that is greater than the number of lines in a macro will exit that macro.
Edited by TonyNo - December 28 2007 at 08:03
|
Back to Top |
|
|
cmhardwick Senior Member
Joined: July 08 2006 Location: United States
Online Status: Offline Posts: 290
|
Posted: December 28 2007 at 08:25 | IP Logged
|
|
|
Tony,
You can also put this in a GOTO LABEL type, as I do, to control program flow . I have it check if it's the device I want, if not, go to the next section and check there, if not, go to the next section, etc. Easier than jump because you can add lines and not have to refigure all your jump statements.
__________________ Cicero, Enjoying automation!
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: December 28 2007 at 10:32 | IP Logged
|
|
|
Absolutely. I actually started replying about labels, but then noticed he was asking about JUMP, not GOTO LABEL.
As you say, labels are powerful.
Code:
GOTO LABEL if([LOCAL1]=0, "A", "B")
LABEL A
USER MESSAGE "Jumped to A"
JUMP 999
LABEL B
USER MESSAGE "Jumped to B" |
|
|
Note that there are no quotes used for the LABEL definition.
|
Back to Top |
|
|
onhiatus Senior Member
Joined: May 12 2004 Location: United States
Online Status: Offline Posts: 279
|
Posted: December 28 2007 at 13:58 | IP Logged
|
|
|
Oops, this was cross posted to Bugs - I anwered the above there. If anyone cares it is here - but basically it says the same thing...
|
Back to Top |
|
|
ficklma1 Groupie
Joined: December 08 2007 Location: United States
Online Status: Offline Posts: 59
|
Posted: December 28 2007 at 17:30 | IP Logged
|
|
|
Thanks everyone!
I appreciate the help.
I renamed my xlobby button_id's to match my PH id's and I'm now passing the [LOCAL7] in the following if statement:
if("[LOCAL10]" = "0", ph_run('C:\Program Files\xlobby\XReceive\xsend.exe ~~"command:xlobby:button state set:[LOCAL7]_toggle:Off~~"'))
with this one if statement, I'm able to have it toggle all my xlobby buttons when the Insteon Device Chg trigger fires.
Thanks again for the great explanations.
|
Back to Top |
|
|
cmhardwick Senior Member
Joined: July 08 2006 Location: United States
Online Status: Offline Posts: 290
|
Posted: December 28 2007 at 20:00 | IP Logged
|
|
|
Great idea on matching the button IDs. I'll have to look into that as well.
__________________ Cicero, Enjoying automation!
|
Back to Top |
|
|