Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Checking Variable Value Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
PhilC
Newbie
Newbie
Avatar

Joined: March 18 2004
Location: United Kingdom
Online Status: Offline
Posts: 39
Posted: February 10 2005 at 19:12 | IP Logged Quote PhilC

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 View PhilC's Profile Search for other posts by PhilC
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: February 10 2005 at 20:04 | IP Logged Quote TonyNo

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 View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
PhilC
Newbie
Newbie
Avatar

Joined: March 18 2004
Location: United Kingdom
Online Status: Offline
Posts: 39
Posted: February 11 2005 at 06:06 | IP Logged Quote PhilC

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 View PhilC's Profile Search for other posts by PhilC
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: February 11 2005 at 07:58 | IP Logged Quote TonyNo

Hmm. That makes no sense. Something else is going on, because what you posted works here.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
PhilC
Newbie
Newbie
Avatar

Joined: March 18 2004
Location: United Kingdom
Online Status: Offline
Posts: 39
Posted: February 11 2005 at 08:17 | IP Logged Quote PhilC

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 View PhilC's Profile Search for other posts by PhilC
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: February 11 2005 at 12:15 | IP Logged Quote dhoward

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 View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: February 11 2005 at 15:35 | IP Logged Quote TonyNo

Ah! I would bet that Dave nailed it!
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
PhilC
Newbie
Newbie
Avatar

Joined: March 18 2004
Location: United Kingdom
Online Status: Offline
Posts: 39
Posted: February 12 2005 at 09:00 | IP Logged Quote PhilC

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 View PhilC's Profile Search for other posts by PhilC
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: February 12 2005 at 10:12 | IP Logged Quote TonyNo

Ah ha!

The second line of the macro should ba a Jump (16), not a Formula (38).

Tony
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
PhilC
Newbie
Newbie
Avatar

Joined: March 18 2004
Location: United Kingdom
Online Status: Offline
Posts: 39
Posted: February 14 2005 at 14:52 | IP Logged Quote PhilC

Thanks Tony...works fine now!
Back to Top View PhilC's Profile Search for other posts by PhilC
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum