The JSL from your latest response creates a Window Object display box with a variable named "nw2" that is used to allow one to reference that display box. The default action of a Window Object is to create a new display window
nw2 = New Window( "New window",
Inside the Window Object a Button Box Display Box with the name, "Test" and a script, "Print("test")". with a variable named "OutputGButton" that is used to reference the Button Box.
outputGButton = Button Box( "Test", print("test");
)
The next object within the Window Object is the JSL to run a Bivariate Platform, with a variable named "biv" that is used to reference the Bivariate Platform object. The default action of the Bivariate Platform is to run a Bivariate analyses and to display the output in either a new window or in this instance to display the output within the nw2 window object. 2 elements are passed to the Bivariate Platform. The column weight is passed to the Y element, and the column height is passed to the X element
biv = Bivariate( y( :weight ), x( :height ) )
At this point in the JSL, the definition of the nw2 window object is completed the a closing ")"
I am going into this level of detail in order to illustrate how the next lines within the script interact with the nw2 window object or with one of the objects within the nw2 window object.
Each of the defined object have messages that can be passed to them. Different types of objects have a different list of messages that can be passed to them. The nw2 window object has messages such as "Set Window Title", "Bring Window To Front", "Close Window" etc. The complete list of messages that can be sent to a window object are listed in the Scripting Index
in the current script
nw2 << Save ByGroup Script to Journal;
it has the "Save ByGroup Script to Journal" message being passed to the nw2 window object. However, that message is not a message available to a window object.
Save ByGroup Script to Journal is a message that is available to JMP Platforms.
The only object in the script that this message can be passed to is the Bivariate platform referenced by the biv variable
biv << Save ByGroup Script to Journal;
However, when this is the way it is used, the script that is passed to the journal only contains the JSL to run the Bivariate, not the script to run the full JSL that creates the window object with it's button box and Bivariate platform.
So what will need to be done, is to write the JSL that places into a journal a button box that contains all of the JSL that is currently in the definition of the nw2 window object.
Basically what the Save ByGroup Script to Journal does, is to create a button box with a specified script. If the requirement is to have something different in the button box that what the given functionality is, then it is up to the user to write the code to make the changes. Below is a script that does the same thing as the Save ByGrooup.... but adds in the specified button box before the output of the Bivariate
Names Default To Here( 1 );
//dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
file = pick file();
dt = open(file);
biv = dt << Bivariate( y( :weight ), x( :height ), invisible );
theScript = Char( biv << get script );
biv << close window;
Eval(
Parse(
"New Window( \!"My Journal\!",
<<journal,
bb = Button Box( \!"Dummy\!",
nw2 = New Window( \!"Output\!",
outputGButton = Button Box( \!"Test\!", Print( \!"test\!" ) ),
open(\!"" || file || "\!") <<
" || theScript || ";
)
)
);
bb << style( \!"Underline\!" );
bb << set button name( dt << get name || Word( 1, theScript, \!"(\!" ) );
Current Journal() << append( ob = Outline Box( \!"All Files\!" ) );
ob << Add All Open Files(menu(1));
"
)
);
It also uses the Menu(1) addition to the Add All Open Files, to let the user choose the files to add
Jim