Author |
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: February 02 2008 at 22:58 | IP Logged
|
|
|
Hi - so I have a macro that consists of 3 formulas..
ph_macroparm(macroname1,a1,b1,c1,d1,e1)
ph_macroparm(macroname2,a2,b2,c2,d2,e2)
ph_macroparm(macroname3,a3,b3,c3,d3,e3)
But wait, I don't want macro2 to start until macro1 is finished, and I don't want macro3 to start until macro2 is finished.
So I should use submacros, but I then have to recode line 1 like this
Set System [LOCAL1] a1
...
Set System [LOCAL5] e1
submacro macroname1
so each line expands to six lines.
This works fine. I'm just wondering if there's a less cumbersome way to code it.
Thanks!
/j
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: February 06 2008 at 14:46 | IP Logged
|
|
|
Jeff,
Im looking at some options to make this easier for the next version. In the meantime, the way you're doing it works, but could be made shorter (more compact) if thats what you want.
Since a "SubMacro" command accepts a single string parameter (the ID of the macro to call), you can actually pass a complete formula as long as it evaluates in the end to the ID of the submacro. Lets say the submacro ID is "SUBMACRO1" and you want to pass the following values in the first 5 local variables: 53, 21, "This is a test", "Windy", and 75. I could have all this on a single submacro command line with this formula:
Code:
"SUBMACRO1" + ph_rtne(ph_setvar_a(1,1,53) + ph_setvar_a(1,2,21) + ph_setvar_a(1,3,"This is a test") + ph_setvar_a(1,4,"Windy") + ph_setvar_a(1,5,75))
|
|
|
The entire formula is evaluated, which results in the LOCAL variables being set appropriately. These values should all equal 0 and are added together. The ph_rtne() function converts the 0 (or whatever the value) to an empty string which is concatenated to the ID of the submacro.
Obviously, if you have fewer parameters to pass, then this formula will be shorter.
Hope this helps,
Dave.
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: February 06 2008 at 14:58 | IP Logged
|
|
|
thanks Dave - I'll have to decide if the compactness is the right tradeoff against the crypticity (8-}), but I was guessing there was a better way, and good to hear that there is.
If you're looking to improve this, I can't complain (though I wouldn't put it too high on the list). The way I would solve it would be with a ph_submacroparm() function which is just like ph_macroparm, except that the calling macro pends until the submacro completes.
Thanks!
/j
Edited by jeffw_00 - February 06 2008 at 14:59
|
Back to Top |
|
|
|
|