how do I Save variable values to new scriptHi,
I'm trying to save metadata to a table, so next time I open the file I will be able to use some variables I used when I built the table.
I understand that currently only strings can be saved as metadata to the table.
The other options I tried is to save new script to the table that will include the variables that I need.
the problem is that I don't understand how to use the "Save Script" in a way that will add the value of the variable instead of the variable name.
for example I tried this :
x = expr (a = [1,2,3]);
dt << New script ("test",char (x));which results in a script with - char(x).
I tried any expr/eval/parse combination I could think of but non of them helped.
I just want the new script "test" to include :
a = [1,2,3]
but when I'm writing the script of course I don't know the actual value of a.
Thanks in advance
ScriptingRe: how do I Save variable values to new scriptHi,
Does this do what you're looking for?:
x = expr ("a = [1,2,3]");
eval(eval expr(dt << New script ("test",char (expr(parse(x))))));Re: how do I Save variable values to new scriptThanks for your help.
I missed the option of using "eval (eval expr(".."))"
The way I finally used it was like this -
a = {1,2,3};
Eval(Eval Expr(dt << New script ("test",
a = expr (a);
)));this way the new test script now include "a = {1,2,3};", which is what I wanted.
Thanks again.
Re: how do I Save variable values to new scriptSlightly different, not necessarily better:
NamesDefaultToHere(1);
dt = NewTable("Test");
myScript =
Expr(
a = {1, 2, 3, 4};
Speak(a);
);
addScript =
Expr(
dt << NewScript(nTBD, sTBD)
);
SubstituteInto(
addScript,
Expr(nTBD), "My Script",
Expr(sTBD), EvalExpr(myScript)
);
addScript;