Re: Direct passing argument to a script fileIs there a reason you need to do it this way? Unless you're constrained from some sort of extreme circumstances, your method of constructing an interactive GUI is not what you should be doing.
Consider using JMP classes -- these allow you to use methods directly as the callbacks on display elements and can greatly simplify GUI construction.
Direct passing argument to a script fileHey,
i wish to pass argument str1, a string argument to a separate script named: "script2run.jsl" for example, nad that script uses str1 argument and print a message such as :
print("This is the important string I successfully passed: " || Eval(str1)) ;
a different script that create a window that will be saved as journal for later usage will triger that script through buttons that would be something like this:
vars4script = {"nine", "one", "two", "eight", "eleven"};
win_click = New Window( "journal window",
Spacer Box( size( 100, 10 ) ),
Header = Text Box( " journal window buttons", <<FONT color=""></FONT>
there are 3 methods here but none is working properly when buttons are clicked
Automation and ScriptingRe: Direct passing argument to a script fileI consider building your UI in some other way, but if you really want to go the way you have suggested, this might work (I would not use this)
Names Default To Here(1);
vars4script = {"nine", "one", "two", "eight", "eleven"};
win_click = New Window("journal window",
Spacer Box(size(100, 10)),
Header = Text Box(" journal window buttons", <<FONT color="">= 1, i--,
Eval(EvalExpr(
buttons_area1 << Append(Button Box(vars4script[i],
str1 = Expr(vars4script[i]);
Expr(Parse(Load Text File("script2.jsl")));
));
));
);
</FONT>Re: Direct passing argument to a script fileIf you can give examples of better ways I'll be more than happy to see. my only constraints are that one generic script will get different variable depending on the button clicked in the UI.Re: Direct passing argument to a script fileIn simple cases, you could most likely use a function and maybe button name as argument. Can you modify your generic script? Could it for example be included at the beginning of your script and then you call a function from that generic script within each of the buttons?
script1.jsl
Names Default To Here(1);
Include("script2.jsl");
vars4script = {"nine", "one", "two", "eight", "eleven"};
win_click = New Window("journal window",
Spacer Box(size(100, 10)),
Header = Text Box(" journal window buttons", <<FONT color=""></FONT>
script2.jsl
Names Default To Here(1);
my_func = function({str}, {Default Local},
Show(str);
);