| 
    
     | 
       
        | Author |  |  
        | jeffw_00 Super User
 
  
 
 Joined: June 30 2007
 Online Status: Offline
 Posts: 935
 | 
          Ok - how do I do this.   8-}
           | Posted: December 01 2007 at 20:57 | IP Logged |   |  
           | 
 |  
 I want to write a Jump formula like
 
 if ( xxx = 1,1,3)
 
 where xxx is the global variable whose NAME is passed by [LOCAL1]
 
 so [LOCAL1] would be a STRING (line "BTNCNT"), and I want to branch on the VALUE of BTNCNT.
 
 I've tried everything I could think of, but no luck....
 
 Thanks!
 /j
 
 |  
        | Back to Top |     |  
        |  |  
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Jeff,
           | Posted: December 01 2007 at 21:14 | IP Logged |   |  
           | 
 |  
 I do this all of the time and find it a very powerful feature of PowerHome.  Instead of the Jump statement, I use a "Goto Label" command.  I set this up like this:
 
 10 Goto Label XXX
 
 where XXX is either a global or local variable in the form of {GLOBAL_ID}, ph_getglobal_s("GLOBAL_ID"), [LOCAL1], or ph_getvar_s(1,1).
 
 Whatever string is contained within either the global or the local variable will be the "Label" line in the macro that will be jumped to.  The great thing about this too is that if the label cant be found, ie. the value contained in the global or local does not match a corresponding label in the macro, PowerHome will just go to the next line following the Goto Label command (no errors).
 
 HTH,
 
 Dave.
 
 |  
        | Back to Top |       |  
        |  |  
        | jeffw_00 Super User
 
  
 
 Joined: June 30 2007
 Online Status: Offline
 Posts: 935
 | 
          Hi Dave - sorry, I don't quite follow.  The value of the GLOBAL_VARIABLE whose name I am passing via LOCAL1 will be a 1 or a 0, and I don't want to goto 1, goto 0, or goto BTNCNT.
           | Posted: December 01 2007 at 21:37 | IP Logged |   |  
           | 
 |  
 I want to branch on the value of the named GLOBAL_VARIABLE for which I have passed only the name, not its value.
 
 I hate to ask again, but I don't see how to do what I'm suggesting from what you said.
 
 I may be explaining myself poorly.  Here's exactly what I'm doing:
 
 MACRO_A:
 ph_macroparm("MACRO_B","BTNPRS",0,0,0,0)
 
 MACRO B:
 Jump  if({[LOCAL1]}=1,1,999)
 ^^^^^^^
 I want the branch to be based on the -value- of global variable BTNPRS, which is one of many possible globals I might pass to MACRO_B.
 
 what I need to know is how to express the variable underlined by ^^^^^^^^ so that it finds the value of the global variable whose name is [LOCAL1]
 
 {[LOCAL1]} didn't work
 {"[LOCAL1]"} didn't work
 (ph_getvar_a(1,1)) didn't work
 {(ph_getvar_a(1,1))} didn't work
 
 and then I ran out of ideas.
 
 Sorry if i'm being dense.
 
 Thanks
 /j
 
 
 
 
 |  
        | Back to Top |     |  
        |  |  
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Jeff,
           | Posted: December 01 2007 at 22:25 | IP Logged |   |  
           | 
 |  
 Ok, I think I understand now.  BTNPRS is the ID of a global variable and this global variable will contain either a 1 or 0.  You'll pass the ID of the global into the called macro via [LOCAL1] in the ph_macroparm function.
 
 Jump if(ph_getglobal_n(ph_getvar_s(1,1)) = 1, 1, 999)
 
 should do the trick.  You could also use variable substitution:
 
 Jump if(ph_getglobal_n("[LOCAL1]") = 1, 1, 999)
 
 Dave.
 
 |  
        | Back to Top |       |  
        |  |  
        | jeffw_00 Super User
 
  
 
 Joined: June 30 2007
 Online Status: Offline
 Posts: 935
 | 
          Hi Dave - Thanks - the first form gave me weird results, but the 2nd form (variable substitution) worked like a champ.
           | Posted: December 01 2007 at 22:40 | IP Logged |   |  
           | 
 |  
 Thanks
 /j
 |  
        | Back to Top |     |  
        |  |  |  |