Hi All,
I'm trying to write a script that can grab Text Edit Boxes and their contents that are contained in an Outline Box (that the user could edit, there could be any number of TEB's, with any text, and could be repeated under a different number of Outline Boxes).
The challenge I have is that I can successfully grab the script for the TEBs that come out as a list, I want to be able to insert that list as a script command in order to have it execute in a new window (essentially saving a copy of what the TEBs are and contain). I'm stuck on getting this to correctly insert/substitute and appear in the new window.
//Example list that would track the name of OBs that could potentially change
OB_Titles={"Title 1", "Title 2"};
//Example window where there would be grabbable text boxes - these can vary in number
report_win=new window("Test", Text_OB=Outline Box(OB_Titles[1],
Text Edit Box("1"),
Text Edit Box("2"),
Text Edit Box("3"),
));
//Grabbing the reference of the boxes using the OB title list in order to get references to the TEBs
text_boxes = report_win <<
XPath("//OutlineBox[normalize-space(text())='" || OB_Titles[1] || "']//TextEditBox");
text_box_script=text_boxes<<get script;
report_win<<close window(no save);
//Example script that I would want to insert the text boxes into
win_template = Expr(
New Window("Test",
Outline Box( "Parent OB",
comm_OB = Outline Box( OB_Titles[1],
V List Box( comment_PLC )
)
)
)
);
//I want to subsitute in the text edit boxes and then have them appear properly in the window
//How to get the TEB commands to go into the expression in a way that they will be executed?
Substitute Into( win_template, Expr(comment_PLC), nameexpr(text_box_script) );
write(win_template);
win_template; //run the window