Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Formula/macro question Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
redoubt
Newbie
Newbie


Joined: February 19 2006
Online Status: Offline
Posts: 16
Posted: March 05 2006 at 18:42 | IP Logged Quote redoubt

if(ph_getglobal_s("SIDE CURTAIN")="open",ph_macro("MOVE SIDE CURTAIN"),ph_setglobal_s("BLANK"=1))

or:

if(ph_getglobal_s("SIDE CURTAIN")="open",ph_macro("MOVE SIDE CURTAIN"))

What I am trying to do is activate the macro "move side curtain" only if it is "open". Will either of these work?
Back to Top View redoubt's Profile Search for other posts by redoubt
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: March 05 2006 at 19:17 | IP Logged Quote TonyNo

You could also use:

Code:
if( "{SIDE CURTAIN}" = "open", ph_macro("MOVE SIDE CURTAIN", 0)
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 05 2006 at 19:30 | IP Logged Quote dhoward

Myself, I would make the logic to check whether to actually execute the macro, in the macro itself. It stands to reason that you may want to trigger the macro from multiple spots so no need to duplicate the logic.

So...I would make the first line of the macro a jump command and if the "SIDE CURTAIN" global = "open" then jump 999 (jump beyond the end of the macro so it never actually runs). If the "SIDE CURTAIN" global is not open, then jump 1 (to the next line). At the end of the macro, set the "SIDE CURTAIN" global to "open" and you're all done. Anytime you want to open the side curtain, just call the macro and the macro makes the determination whether it actually runs or not.

HTH,

Dave.

Tony...have you ordered your Insteon PowerLinc yet ?
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: March 05 2006 at 19:37 | IP Logged Quote TonyNo

Dave... Not yet. A few more minutes!
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
redoubt
Newbie
Newbie


Joined: February 19 2006
Online Status: Offline
Posts: 16
Posted: March 05 2006 at 19:42 | IP Logged Quote redoubt

I'm getting closer. My macros are working from PH. Still working on getting the trigger reliable. I actually had to reboot the program and turn off the PowerLinc. I think it was jammed up a bit.

Anyway... The curtains are controlled by more than one thing. One is direct. It moves it to the opposite position and updates the global var. The second is the logic based one to set a specific scene, so the logic is not actually duplicated.

My new question is:... how do i make it execute two macros at once? My "MOVIE PREVIEW" macro will close the side curtain if it is open and open the screen curtain if it is closed. I have tried all four combos and it works fine. The trouble is (when it has to move both) it waits for the first macro's delay to expire before it starts the second.
Back to Top View redoubt's Profile Search for other posts by redoubt
 
redoubt
Newbie
Newbie


Joined: February 19 2006
Online Status: Offline
Posts: 16
Posted: March 05 2006 at 19:57 | IP Logged Quote redoubt

I'm took out the delays and off commands from the move macros and got the screens to move simultaneous. A single delay in the "preview" macro allows the motors to run and then be turned off.

So now... I've set up a "MULTI CURTAIN" variable to by pass the delay and motor shutoffs in the move macros. My question is how do I "jump" or "goto" on a conditional basis? (I've been looking at the help file and cannot determine the correct command.)

Thanks!
Back to Top View redoubt's Profile Search for other posts by redoubt
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: March 05 2006 at 20:03 | IP Logged Quote TonyNo

Quote:
how do I "jump" or "goto" on a conditional basis?

Make the macro line a JUMP, then use an if()...

JUMP if( Option1=1, 1, 2)

This will jump one line if Option1 is 1, if not, it jumps two lines.

You could also use GOTO LABEL with a LABEL defined...

GOTO LABEL if( Option1=1, "ALine", "BLine")
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
redoubt
Newbie
Newbie


Joined: February 19 2006
Online Status: Offline
Posts: 16
Posted: March 05 2006 at 20:09 | IP Logged Quote redoubt

does a jump of 1 line go to the next line? Or does a jump of 0 go to the next line?
Back to Top View redoubt's Profile Search for other posts by redoubt
 
TonyNo
Moderator Group
Moderator Group
Avatar

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

1 goes to the next line. Do you use irc?
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
redoubt
Newbie
Newbie


Joined: February 19 2006
Online Status: Offline
Posts: 16
Posted: March 05 2006 at 20:23 | IP Logged Quote redoubt

Macros are running sweet now. Thanks for all the help.

Now a trigger problem, but started a new thread for that.

Back to Top View redoubt's Profile Search for other posts by redoubt
 
nadler
Super User
Super User


Joined: February 25 2006
Location: United States
Online Status: Offline
Posts: 354
Posted: March 12 2006 at 14:59 | IP Logged Quote nadler

Would you mind posting the entire macro? I'm new to Power-home and can't yet do more than the simple macros. I'm a little frustrated with the more complicated macros, formulas and triggers. I've found I learn better by seeing a lot of examples and then coping them and trying out variations.

Also, I'd be willing to gather a collection of macros etc and post them here for other newbies like me to learn from.

So if anyone else wants to submit your macros, formulas and triggers I will collect them and post them.
Thanks!
Back to Top View nadler's Profile Search for other posts by nadler
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 12 2006 at 23:11 | IP Logged Quote dhoward

Nadler,

Have you taken a peek at the sample database yet? It's included with PowerHome in the database directory and is phsample.db.

You can browse it by opening the PowerHome Explorer and pressing the F7 key. Browse to the database directory (c:\program files\powerhome\database) and open the phsample.db file. You can also export macros, etc. of interest by right-clicking and choosing export.

If you want to actually launch PowerHome using the sample database, edit the pwrhome.ini file and under the [Database] section, change the DBF parameter to point to the sample database. Save and restart PowerHome and you'll be working with the sample database. To go back to your database, just reverse the above.

HTH,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
nadler
Super User
Super User


Joined: February 25 2006
Location: United States
Online Status: Offline
Posts: 354
Posted: March 13 2006 at 17:30 | IP Logged Quote nadler

Thanks for reminding me there was a sample database. I had read that it was included in the manual but I didn't look at it yet. I was too 'busy' trying to get my Insteon stuff to work! I will now though. Thanks for the reminder
Back to Top View nadler's Profile Search for other posts by nadler
 

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