Author |
|
PhilC Newbie
Joined: March 18 2004 Location: United Kingdom
Online Status: Offline Posts: 39
|
Posted: February 10 2005 at 19:12 | IP Logged
|
|
|
Hi,
I have a fairly simple question.
I have a 'power on' macro that powers up all my stuff in one go (projector, amp, lights etc).
The problem is if somebody hits the 'power on' button when everything is on already which would actually turn things off.
What I need to do is set a global variable at the start of the macro..ie POWER=ON
...question is, how do I then check to see if POWER=ON or POWER=OFF and quit out of the macro displaying a message box if the POWER=ON or let it continue if POWER=OFF??
many thanks
Phil
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: February 10 2005 at 20:04 | IP Logged
|
|
|
If you had a global variable called POWER, you could use this to check it...
if( {POWER}="ON", 999, 1)
If you did a... Set Global | {POWER} | "ON"
This would jump out of the macro when the variable is "ON", and, just drop down to the next line when not.
But, what you have is a feature, not a bug! That same macro can turn off everything, too!
HTH
|
Back to Top |
|
|
PhilC Newbie
Joined: March 18 2004 Location: United Kingdom
Online Status: Offline Posts: 39
|
Posted: February 11 2005 at 06:06 | IP Logged
|
|
|
Thanks Tony,
I have tried that, but the Macro still plays regardless of the value of the variable.
The Macro is:
if("{POWER}"="ON", 999, 1)
ph_setglobal_a( "POWER", "ON" )
--- rest of the macro below ---
Thanks
Phil
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: February 11 2005 at 07:58 | IP Logged
|
|
|
Hmm. That makes no sense. Something else is going on, because what you posted works here.
|
Back to Top |
|
|
PhilC Newbie
Joined: March 18 2004 Location: United Kingdom
Online Status: Offline Posts: 39
|
Posted: February 11 2005 at 08:17 | IP Logged
|
|
|
Very odd. Maybe the clue is in the rest of the macro. It's only a test macro with one extra line which is turning on an amp via IR
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: February 11 2005 at 12:15 | IP Logged
|
|
|
Phil,
The only thing that I can think of is to make sure that the if("{POWER}"="ON", 999, 1) is the formula for a macro "Jump" command.
If you can, export the macro and paste the SQL here and we'll get it working for you.
Dave.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: February 11 2005 at 15:35 | IP Logged
|
|
|
Ah! I would bet that Dave nailed it!
|
Back to Top |
|
|
PhilC Newbie
Joined: March 18 2004 Location: United Kingdom
Online Status: Offline Posts: 39
|
Posted: February 12 2005 at 09:00 | IP Logged
|
|
|
Hi Dave,
macro is:
insert into macroheader values ('TEST','TEST',0,0,1);
insert into macrodetail values ('TEST',1,38,'',0,'if( "{POWER}"="ON", 999, 1) ',0);
insert into macrodetail values ('TEST',2,38,'',0,'ph_setglobal_a( "POWER", "ON" )',0);
insert into macrodetail values ('TEST',3,0,'SWITCHER',4,'',0);
Many thanks
Phil
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: February 12 2005 at 10:12 | IP Logged
|
|
|
Ah ha!
The second line of the macro should ba a Jump (16), not a Formula (38).
Tony
|
Back to Top |
|
|
PhilC Newbie
Joined: March 18 2004 Location: United Kingdom
Online Status: Offline Posts: 39
|
Posted: February 14 2005 at 14:52 | IP Logged
|
|
|
Thanks Tony...works fine now!
|
Back to Top |
|
|