BookmarkSubscribe
Choose Language Hide Translation Bar
sdinardo325
Occasional Contributor

Script to save current report as .ppt, triggered by button click

*I found a couple of very similar posts that were resolved in the past, but I've failed to utilize the solutions....sorry for this being a duplicate post.

 

I'm trying to add a script triggered by a button click that can save the currently open report generated from Gaussian process modeling as a .pptx file. I've found a relevant example of << save presentation( ... ) in the scripting index but have been unable to place this as a functional argument of the Button Box( "test", [here]).

 

Here is my script so far:

 

// "//!" placed at the first line of script results in auto-run rather than to open the script
// //!
//opens a new window
w = New Window( "Load Your Data Table",
Text Box( "Choose an Excel file in which your data is linearized into
columns and transformed into Log10[x]." ),

//button to load data
Button Box( "1. Load data table", dt = Open( ) ),

//button to set column type
Button Box( "2. Set column type to Numeric/Continuous", dt = current data table();
for (i = 1, i <= ncols(dt), i++, column(dt, i) << data type(numeric);
column(dt, i) << set modeling type(continuous))),

//button to initiate Gaussian modeling
Button Box( "3. Gaussian modeling", obj = Gaussian Process(Estimate Nugget(1),
Set Correlation Function("Cubic"), Profiler(1),
SendToReport( Dispatch( {}, "Model Report", OutlineBox, {Close( 1 )})),

//automatically saves the Gaussian analysis as a script to the data table
<< Save Script to Data Table(
"Gaussian modeling",
<<Prompt( 0 ),
<<Replace( 0 )));

//new window with help text
New Window( "Help", fontobj = text = Text Box( "For the X-axis: choose the assay variables that have been titrated.
For the Y-axis: choose the signal to background data.
Then click OK; this script will be saved to the current analysis." ), << Justify Text("center") )),

//button to save report to a pptx
Button Box( "4. Save report to a powerpoint", [here] ) ),


//button to close the original window
Button Box( "Close", w << Close Window)
);

 

 

 

 

0 Kudos
2 REPLIES 2

Re: Script to save current report as .ppt, triggered by button click

The <<SavePresentation() message is valid for display box objects, so you will need something like this to get the report from the platform that you have created:

 

(obj << Report) << Save Presentation( "$DOCUMENTS/report.pptx" )

Alternatively you could use Current Report(), but that leads to some issues if you do something else after creating the report and before exporting the Powerpoint.  The same applies for the creation of your report as well - it's probably a good idea to use:

 

obj = dt << Gaussian Process(...)

The 'dt' will help ensure that the correct table is used, and you might add Names Default To Here(1) at the top to ensure that these JSL variables that you create will not conflict with others.

0 Kudos
sdinardo325
Occasional Contributor

Re: Script to save current report as .ppt, triggered by button click

Hi, thanks a lot for the clarity. I've implemented the changes you've suggested but can't manage to get the button click to initiate saving the report as a .pptx still. The button click appears to load for a microsecond but nothing is saved to the desktop.

 

// "//!" placed at the first line of script results in auto-run rather than to open the script
// //!
Names Default To Here(1);
//opens a new window
w = New Window( "Load Your Data Table",
Text Box( "Choose an Excel file in which your data is linearized into
columns and transformed into Log10[x]." ),

//button to load data
Button Box( "1. Load data table", dt = Open( ) ),

//button to set column type
Button Box( "2. Set column type to Numeric/Continuous", dt = current data table();
for (i = 1, i <= ncols(dt), i++, column(dt, i) << data type(numeric);
column(dt, i) << set modeling type(continuous))),

//button to initiate Gaussian modeling
Button Box( "3. Gaussian modeling", obj = dt << Gaussian Process(Estimate Nugget(1),
Set Correlation Function("Cubic"), Profiler(1),
SendToReport( Dispatch( {}, "Model Report", OutlineBox, {Close( 1 )})),

//automatically saves the Gaussian analysis as a script to the data table
<< Save Script to Data Table(
"Gaussian modeling",
<<Prompt( 0 ),
<<Replace( 0 )));

//new window with help text
New Window( "Help", fontobj = text = Text Box(
"For the X-axis: choose the assay variables that have been titrated.
For the Y-axis: choose the signal to background data.
Then click OK; this script will be saved to the current analysis." ), << Justify Text("center") )),

//button to save report to a pptx
Button Box( "4. Save report to a powerpoint", (obj << Report) << SavePresentation("$Desktop\my_report.pptx")),

//button to close the original window
Button Box( "Close", w << Close Window)
);

 

 

0 Kudos