Author |
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: December 25 2014 at 12:31 | IP Logged
|
|
|
Dave-
If you ever get bored and want something to do, here is a product enhancement thought.
I make quite a bit of use of the ph_macropram() function, but it is rather ungainly in many respects.
How hard would it be to create a mechanism to allow one to define their own macro calls, so that instead of....
ph_macroparm("INSTEON-CMD", a, a, a,,)
One could just do....
my_insteoncmd(a, a, a)
Two things to note:
1. The "my_" would be a reserved tag in place of "ph_" to designate this was a user defined function call, with the user macro name following.
2. It would REALLY be nice to have a variable parameter list and not have to null fill unused parameters !!
Just thinkin'
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
gg102 Senior Member
Joined: January 29 2013 Location: United States
Online Status: Offline Posts: 245
|
Posted: December 25 2014 at 12:56 | IP Logged
|
|
|
I'd second that....
If I can add "MY" request, it would be for a global search and replace.
Somewhere with the version upgrades, a lot of underscore characters went missing, I'd like to get everything back to what they were. We do have "Reports/where used", maybe add "change to"...with a prompt y/n JIC.
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: December 26 2014 at 21:32 | IP Logged
|
|
|
I like it!
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: December 27 2014 at 08:11 | IP Logged
|
|
|
Yet another thought. The Event Log is extraordinarily useful in debugging macro code and in catching errors.
Unfortunately any error messages (when unusual conditions are discovered) written by Macros can only use User Message or msgbox()
The latter can pollute the monitor screen quickly, and even crash PH, if the messages aren't seen and deleted within a short time.
The former has the drawback that there are normally MANY User Messages posted by normal working Macros. This makes it almost impossible to "spot" the error messages, mixed in with all the other normal message traffic.
Could another message type be added (eg, Error Message in addition to User Message)?
This would probably be colored a red tone vs green in the Event Log and could be Filtered with a "type=xx" string to permit quick discovery and review.
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
gg102 Senior Member
Joined: January 29 2013 Location: United States
Online Status: Offline Posts: 245
|
Posted: December 27 2014 at 10:52 | IP Logged
|
|
|
Well, gee, if we're allowed two, my second request would be for "CONSTANTS".
Currently I use GVs as constants, but that requires a disk hit to resolve. Maybe here CONSTANTS would be stored in memory. Yes, usually, CONSTANTS are resolved at compile time, in this case they could be stored in memory and substituted at run-time rather than suffering a disk hit. They could be loaded at start-up or re-init or a force-reload function.
This way, if you want to change, for example, a button, all you need to do is change the CONSTANT.
So you could:
DEF CC_FAMILY_ROOM equ "__AG_FMLYRM"
DEF TABLE_LIGHT_ON_BUTTON equ "GB1N"
DEF GREEN_BUTTON equ "C:\powerhome\web\graphics\buttons\b10green_50.gif"
DEF BLUE_BUTTON equ "C:\powerhome\web\graphics\buttons\b10blue_50.gif"
So in a macro you could say:
ph_setccobjgraphic ( CC_FAMILY_ROOM, TABLE_LIGHT_ON_BUTTON, GREEN_BUTTON, BLUE_BUTTON)
This makes the code more read-able and easier to change globally; you just change the CONSTANT and the whole program operates with the new value.
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: December 27 2014 at 13:11 | IP Logged
|
|
|
gg102 wrote:
Well, gee, if we're allowed two, my
second request would be for "CONSTANTS". |
|
|
Oh yah! I like that a lot. Especially making the code
easier to read and understand later. I have so much
now, written over many years, that even with significant
commenting efforts, I still have to scratch my head
sometimes to figure out what I was doing.
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 30 2014 at 14:31 | IP Logged
|
|
|
Unfortunately, being able to "create" your function names would not be doable in the current environment. The entire PowerHome formula evaluation routines relies upon the datawindow evaluation command and saves me from having to write my own parsing and evaluation routines which while possible, would be much slower than the built in one. The PowerHome ph_XXX global functions are compiled directly into the application and cannot be created dynamically.
I'll look into it further but I don't think I'll be able to find a way to make this one happen.
Adding another eventlog message is doable. I would probably call it "User Error" with a new function to generate it. It would be exactly like the current usermessage function with a different eventlog ID and different colors.
Constants (to some degree) may be doable. The current datawindow evaluator already as some constants internally defined (ion, ioff, ifaston, etc) and since its a datawindow, may be able to dynamically create new ones. However, these constants would ONLY work from within a formula and wouldnt work from fields that are currently interpreted only as a string (such as graphic path/filename fields). It would be possible to add a search and replace type function (vs a formula evaluator constant) to these fields but it would add a little overhead as every field would need to have this applied before being able to be used. I'll look into it though.
Global search and replace is already on the to-do list.
Dave.
|
Back to Top |
|
|
|
|