You can also just parse your data and execute. So if the name in column 1 is circle, line, rect, pass the variables to circle, line, rect with e.g. a switch statement.
Thanks for your advice Jeremey. I'll follow-up on the links and the process you suggested. Overall, I'm grateful for the support of the community within this forum.
G
To expand on the non-code solution, it looks something like this:
for each line in data
switch on the keyword
if the keyword is "rect", pass args 2,3,4,5... to rect
if the keyword is "ellipse" pass the args to ellipse... etc.
If you are doing something simple, this is pretty easy -- much easier than code evaluation. If you are trying to push and pop styles, specify loops in your data, etc. then this can get really complicated really quickly -- and then it is much easier to implement a code evaluation solution and focus on programming in your data rather than inventing your own language / parser.
Answers
not so easy
best store the numbers separated by commas without rect, commas or ( ) ;
just
30, 20, 55, 55
look at loadstrings and split in the reference
Thanks for your response Chrisir! I'm still hoping there's a way to load a string from which to write commands in addition to insert variables.
Do your files contain Processing commands?
Kf
Yes, my .txt file contains a Processing command.
Sounds like you are interested in code evaluation during program execution. See past discussions, e.g.
@GoToLoop sometimes recommends nashhorn.
You can also just parse your data and execute. So if the name in column 1 is circle, line, rect, pass the variables to circle, line, rect with e.g. a switch statement.
Thanks for your advice Jeremey. I'll follow-up on the links and the process you suggested. Overall, I'm grateful for the support of the community within this forum. G
Good luck, @garystil.
To expand on the non-code solution, it looks something like this:
If you are doing something simple, this is pretty easy -- much easier than code evaluation. If you are trying to push and pop styles, specify loops in your data, etc. then this can get really complicated really quickly -- and then it is much easier to implement a code evaluation solution and focus on programming in your data rather than inventing your own language / parser.