| Author |  | 
      
        | MrGibbage Super User
 
  
  
 Joined: October 23 2006
 Location: United States
 Online Status: Offline
 Posts: 513
 | 
          local, temp and global.  ph_setvar, ph_getvar and all the other functions like it.  What I don't see is a simple way to
           | Posted: April 03 2010 at 23:43 | IP Logged |   |  
           | 
 |  assign a local use variable (by local use, I mean visible to the currently running macro and that's it).
 ph_setvar(3,19,SOME_VALUE) just isn't all that readable.  I really long for a way to have a statement that looks like
 SOME_VARIABLE=SOME_VALUE.  Am I missing it, or am I just over-reacting?
 
 Skip
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | TonyNo Moderator Group
 
  
  
 Joined: December 05 2001
 Location: United States
 Online Status: Offline
 Posts: 2889
 | 
          You can use the drop-downs in a macro. Use "SET SYSTEM", then, choose your Local.
           | Posted: April 04 2010 at 21:13 | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |       | 
       
       
        |  | 
        | BeachBum Super User
 
  
  
 Joined: April 11 2007
 Location: United States
 Online Status: Offline
 Posts: 1880
 | 
          I’m having a problem understanding the question. If you talking about re-entrant and reusable the same macro runs serially. SOME_VARIABLE=SOME_VALUE is that referring to setting the variable to a variable value?
           | Posted: April 04 2010 at 21:25 | IP Logged |   |  
           | 
 |  
 Edited by BeachBum - April 04 2010 at 21:28
 
 __________________
 Pete - X10 Oldie
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | MrGibbage Super User
 
  
  
 Joined: October 23 2006
 Location: United States
 Online Status: Offline
 Posts: 513
 | 
          In any programming language outside of powerhome, you have statements like I=10, CurrentRow=CurrentRow+1,
           | Posted: April 04 2010 at 22:20 | IP Logged |   |  
           | 
 |  or any other similar statements.
 Here, we have to use LOCAL1 and then write a function that evaluates to some value.  When it
 is time to review the program, I have to ask myself, what was LOCAL1 again?  Sure, I could
 use globals, but that is really messy.  No other programming language would say, if you
 EVER, in any program, use "I", then you can't use it again.
 
 Even worse is ph_setvar_s(3,33,myfunction).  I say worse because in my opinion is is even harder
 to read than the set system LOCAL.  Again, when I come back to this program, I ask myself,
 what was ph_setvar(3,33,...) again???
 
 My question is about readability.  The system we have does work.  We have local and global
 variables, and lots of ways of setting and retrieving values.  But in my opinion, it is
 messy.  One immediate improvement would be if we could change the names of the local
 variables.  That would actually help out a lot.
 
 Maybe I should work on converting my programs to VB Script???  Has anyone here taken the
 time to write a tutorial on how to convert a macro or two into VB Script?
 
 Edited by MrGibbage - April 04 2010 at 22:21
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | BeachBum Super User
 
  
  
 Joined: April 11 2007
 Location: United States
 Online Status: Offline
 Posts: 1880
 | 
          Thank you for clarifying and I totally agree…..
           | Posted: April 04 2010 at 22:44 | IP Logged |   |  
           | 
 |  
 __________________
 Pete - X10 Oldie
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | grif091 Super User
 
  
 
 Joined: March 26 2008
 Location: United States
 Online Status: Offline
 Posts: 1357
 | 
          I put a comment or two in each Macro describing what each variable contains.  Not as pretty as a full blown programming language but if you want to program in a language then one of the Script based languages that the Windows Script Host (WSP) supports might be a better choice.  VBScript and JScript are supported for sure.  Probably more but that is really a WSP question rather than a PowerHome question.
           | Posted: April 04 2010 at 23:48 | IP Logged |   |  
           | 
 |  
 __________________
 Lee G
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | MrGibbage Super User
 
  
  
 Joined: October 23 2006
 Location: United States
 Online Status: Offline
 Posts: 513
 | 
          I've been thinking about this, and I think a very real solution to this would be if we could
           | Posted: April 05 2010 at 06:48 | IP Logged |   |  
           | 
 |  use any name we wanted for our local variables.  What if there was a dropdown in the macro
 detail to "DECLARE LOCAL VARIABLE", and then it could have an option for variable type
 (string, integer, whatever), and then in the formula area you enter the name of the
 variable.  Then when you use the set system drop down, the variable should be listed and
 usable.
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | dhoward Admin Group
 
  
  
 Joined: June 29 2001
 Location: United States
 Online Status: Offline
 Posts: 4447
 | 
          I am looking into this.  Wont be in the next beta and wont be able to be quite like requested but Ive been working on a way to do something very similar
           | Posted: April 17 2010 at 19:44 | IP Logged |   |  
           | 
 |    
 Dave.
 
 | 
       
        | Back to Top |       | 
       
       
        |  |