How to get this script list to correctly insert into an expresisonHi 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=""></GET>Re: How to get this script list to correctly insert into an expresisonHi Ben,
One way (of many ways, I'm sure) to do what I think you are trying to do is to put a handle on the vlistbox in the New Window script and append each textbox once the window is present.
Cheers,
Brady
Names Default to Here(1);
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=""></GET>Re: How to get this script list to correctly insert into an expresisonIf, alternatively, you wish to build the new window expression for use later, you can do this:
nwExpr = Expr(
New Window( "Test",
Outline Box( "Parent OB", comm_OB = Outline Box( OB_Titles[1],
_VLB_SPEC ) )
)
);
// build up the vlistbox with its arguments
vlbExpr = Expr( V List Box() );
For Each( {s}, text_box_script, Insert Into( vlbExpr, Name Expr( s ) ) );
// once built, substitute into nwExpr
substitute Into (nwExpr, expr(_VLB_SPEC), nameexpr(vlbExpr));
// to show the window, evaluate nwExpr
nwExpr;