Author |
|
redoubt Newbie
Joined: February 19 2006
Online Status: Offline Posts: 16
|
Posted: March 05 2006 at 18:42 | IP Logged
|
|
|
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 |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: March 05 2006 at 19:17 | IP Logged
|
|
|
You could also use:
Code:
if( "{SIDE CURTAIN}" = "open", ph_macro("MOVE SIDE CURTAIN", 0) |
|
|
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 05 2006 at 19:30 | IP Logged
|
|
|
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 |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: March 05 2006 at 19:37 | IP Logged
|
|
|
Dave... Not yet. A few more minutes!
|
Back to Top |
|
|
redoubt Newbie
Joined: February 19 2006
Online Status: Offline Posts: 16
|
Posted: March 05 2006 at 19:42 | IP Logged
|
|
|
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 |
|
|
redoubt Newbie
Joined: February 19 2006
Online Status: Offline Posts: 16
|
Posted: March 05 2006 at 19:57 | IP Logged
|
|
|
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 |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: March 05 2006 at 20:03 | IP Logged
|
|
|
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 |
|
|
redoubt Newbie
Joined: February 19 2006
Online Status: Offline Posts: 16
|
Posted: March 05 2006 at 20:09 | IP Logged
|
|
|
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 |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: March 05 2006 at 20:10 | IP Logged
|
|
|
1 goes to the next line. Do you use irc?
|
Back to Top |
|
|
redoubt Newbie
Joined: February 19 2006
Online Status: Offline Posts: 16
|
Posted: March 05 2006 at 20:23 | IP Logged
|
|
|
Macros are running sweet now. Thanks for all the help.
Now a trigger problem, but started a new thread for that.
|
Back to Top |
|
|
nadler Super User
Joined: February 25 2006 Location: United States
Online Status: Offline Posts: 354
|
Posted: March 12 2006 at 14:59 | IP Logged
|
|
|
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 |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: March 12 2006 at 23:11 | IP Logged
|
|
|
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 |
|
|
nadler Super User
Joined: February 25 2006 Location: United States
Online Status: Offline Posts: 354
|
Posted: March 13 2006 at 17:30 | IP Logged
|
|
|
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 |
|
|