| Author |  | 
      
        | jeffw_00 Super User
 
  
 
 Joined: June 30 2007
 Online Status: Offline
 Posts: 935
 | 
          Hi.  When I call my macros from Triggers, I pass an parameter so that the macro can distinguish between when it is called from a Trigger or a Timed event.  Thus, all my macros now use [LOCAL1].
           | Posted: November 30 2007 at 21:58 | IP Logged |   |  
           | 
 |  
 Except, when I try to play a macro from the Explorer, [LOCAL1] is undefined and the macro dies.
 
 This sort of sucks, as I play macros from the explorer all the time to debug.  Did I just hang myself? or (as I expect) does awesome PH have a way around this?
 
 Edited by jeffw_00 - November 30 2007 at 21:59
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Jeff,
           | Posted: December 01 2007 at 15:57 | IP Logged |   |  
           | 
 |  
 Ive been thinking and thinking on this one and cant figure out an easy way around this.  The variable set is created new each time a macro is run.  Each macro, etc. gets it's own set of variables and they are all initialized as an empty string.  The only way I can think to fix it would be change your routine at the beginning of each macro from a variable substitution ([LOCAL1]) to a function (ph_getvar_n(1,1)).  You should be able to do this using SQL or by exporting and re-importing.
 
 I cant really think of any other way around this unless specific checking for this event is placed into each macro.
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | jeffw_00 Super User
 
  
 
 Joined: June 30 2007
 Online Status: Offline
 Posts: 935
 | 
          so are you saying I should do something like
           | Posted: December 01 2007 at 16:28 | IP Logged |   |  
           | 
 |  
 ph_macroparm("MACRONAME",(ph_getvar_n(1,1)),0,0,0,0)
 
 (i.e., textually replace [LOCAL1] with (ph_getvar_n(1,1)) everywhere?)
 
 yup - that seems to work - thanks
 
 Ok - I've taken a couple of shots at coming up with the way to do it within SQL - since [LOCAL1] isn't always the same parameter I'm out of my league.  If you have an easy way please post.  I'm going to try to do it exported (since it's a simple text substitution), but I'd be curious how to do it in SQL if you know off-hand
 
 
 
 Thanks!
 /j
 
 (now, if I could "force" [LOCAL1] so that I could easily test a macro with it set to 1 or 0..... - ponder that for the next release 8-})
 
 
 Edited by jeffw_00 - December 01 2007 at 16:39
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          Should be easy enough to "force" the [LOCAL1] setting for testing of macros.  Just open the Multi-Editor in PH Formula mode and call the macro using ph_macroparm with the appropriate value for [LOCAL1].
           | Posted: December 01 2007 at 21:24 | IP Logged |   |  
           | 
 |  
 Another thing you may want to try is creating a special macro for testing your other macros.  This macro would look like this:
 
 10 Input Box No TTS "Enter the Macro ID to test:"
 20 Set System [TEMP1] "[INPUTRET]"
 30 Input Box No TTS "Enter the value to use for LOCAL1:"
 40 Set System [LOCAL1] "[INPUTRET]"
 50 Formula Immediate ph_macroparm("[TEMP1]","[LOCAL1]",0,0,0,0)
 
 Give this macro a menu hotkey and then you can quickly and easily test your macros.
 
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | jeffw_00 Super User
 
  
 
 Joined: June 30 2007
 Online Status: Offline
 Posts: 935
 | 
          DH> Should be easy enough to "force" the [LOCAL1] setting for testing of macros. Just open the Multi-Editor in PH Formula mode and call the macro using ph_macroparm with the appropriate value for [LOCAL1].
           | Posted: December 01 2007 at 21:28 | IP Logged |   |  
           | 
 |  
 JW> I knew that 8-}. Wish I could temporarily define LOCAL1 as a global somehow (just daydreaming).
 
 DH> Another thing you may want to try is creating a special macro for testing your other macros. ... Give this macro a menu hotkey and then you can quickly and easily test your macros.
 
 JW> Yeah, but then I'd have to -type- something.
 Just giving you a hard time - this all makes a lot of sense.
 
 Thanks!
 /j
 
 Edited by jeffw_00 - December 01 2007 at 21:40
 | 
       
        | Back to Top |     | 
       
       
        |  |