Author |
|
MrGibbage Super User
Joined: October 23 2006 Location: United States
Online Status: Offline Posts: 513
|
Posted: April 03 2010 at 23:43 | IP Logged
|
|
|
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
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
|
Posted: April 04 2010 at 21:13 | IP Logged
|
|
|
You can use the drop-downs in a macro. Use "SET SYSTEM", then, choose your Local.
|
Back to Top |
|
|
BeachBum Super User
Joined: April 11 2007 Location: United States
Online Status: Offline Posts: 1880
|
Posted: April 04 2010 at 21:25 | IP Logged
|
|
|
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?
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
|
Posted: April 04 2010 at 22:20 | IP Logged
|
|
|
In any programming language outside of powerhome, you have statements like I=10, CurrentRow=CurrentRow+1,
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
|
Posted: April 04 2010 at 22:44 | IP Logged
|
|
|
Thank you for clarifying and I totally agree…..
__________________ Pete - X10 Oldie
|
Back to Top |
|
|
grif091 Super User
Joined: March 26 2008 Location: United States
Online Status: Offline Posts: 1357
|
Posted: April 04 2010 at 23:48 | IP Logged
|
|
|
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.
__________________ Lee G
|
Back to Top |
|
|
MrGibbage Super User
Joined: October 23 2006 Location: United States
Online Status: Offline Posts: 513
|
Posted: April 05 2010 at 06:48 | IP Logged
|
|
|
I've been thinking about this, and I think a very real solution to this would be if we could
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
|
Posted: April 17 2010 at 19:44 | IP Logged
|
|
|
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
Dave.
|
Back to Top |
|
|