cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
txnelson
Super User

Retrieving a path and filename after Save Presentation() is used with no path specified

I am using Save Presentation() to save a journal to ppt.  However, I want to allow the user to specify the path and file name to save the ppt.  If the Save Presentation() is specified without specifying a path/filename, JMP very nicely pops up an operating system Save File window, which allows the user to navigate to whatever folder they desire, and to specify whatever filename they desire.  The issue is, that when this method is used, I have not figured out a way to get the path and file name for the saved file.

Does anyone have a solution to this question?

 

 

Jim
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Retrieving a path and filename after Save Presentation() is used with no path specified

Hey, JIm.

 

It looks like Pick File() with the Save option is pretty close to what you describe:

rbiv << Save Presentation( path = Pick File("save", "$TEMP", {"PowerPoint|pptx"}, 1, 1) );
Show( path );
/*:

path = "/C:/Users/wemurp/AppData/Local/Temp/myPowerPoint.pptx";

Hope that helps!

 

Wendy

View solution in original post

6 REPLIES 6
gzmorgan0
Super User (Alumni)

Re: Retrieving a path and filename after Save Presentation() is used with no path specified

Jim,

 

There are a few ways to do this. Below are a few snippets, showing the two methods to Save Presentation without a prompt. We added a script to our JSL Companion 2nd ed. scripts that discuss our BKM (best known method) for using save presentation and dealing with the scaling issue.

 

If I need to create a complex PPTX output, I use JSL to create the commands for an extrenal program p3icli, then run it using Run Program.

 

/*
  Save Presentation appends if the file exists. This next line assures that only the current programs requested
  reports are saved. Another option is to add a datetime to the filename for version control.
*/    
	    if( FileExists(usr_aa["pptPath"]), DeleteFile(usr_aa["pptPath"]) );
	    Copy File(templ,usr_aa["pptPath"]);
	    result << Save Presentation( usr_aa["pptPath"], Insert(2), Outline Titles("BottomRight"), "PNG");
	    wait(2);
	    result << Close Window(NoSave);
	  )	

Or use this syntax

nme = "c:\temp\ROR Report-" || Format(Today(),"yyyymmdd") ||".pptx";
tjwin << Save Presentation(nme, Template("$JSL_Companion/ROR_BaseTemplate.pptx"),"PNG" );  

 

Description: P3ICLI (PowerPoint Picture Insert Command Line Interface) is a
script driven application that inserts user-selected picture and/or graphic files
into Microsoft PowerPoint (R) slides.

P3ICLI can be downloaded from https://sourceforge.net/projects/p3icli/
It documents a JSL example, including the ppt template, JSL script, explanation and resulting
pptx file at https://p3icli.sourceforge.io/jsl_example.html. We like the flexibility it offers
to customize, size, layout, titles and captions. Note: a link to the resulting PPTX is on teh last line of the webpage. 

 

txnelson
Super User

Re: Retrieving a path and filename after Save Presentation() is used with no path specified

Ms. Morgan,

Thank you for replying.

I obviously failed at specifying my question to any degree of coherency. Let me attempt this again.  

If I use the following code:

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = bivariate( y( :weight ), x( :height ) );
rbiv = biv << report;
rbiv << Save Presentation(  );

it will generate the Bivariate Platform output and then, because the "Save Presentation()" does not have any path/file name specified, JMP very nicely opens up a window that allows the user to navigate to whatever directory they want, and to specify whatever file name they want.

save.PNG

This is the behavior I want.  However, what I need but I can not figure out how to get i is, that after the user click on "Save" and the Bivariate output is saved to the location and file name

"How to I determine what path/file name the user specified?".  

 

 

Jim
Craige_Hales
Super User

Re: Retrieving a path and filename after Save Presentation() is used with no path specified

I don't see a way to capture the user-selected path/name from JSL. 

Craige
gzmorgan0
Super User (Alumni)

Re: Retrieving a path and filename after Save Presentation() is used with no path specified

Sorry, Jim.

I thought my interpretation of the question was incongruous with your skills and knowledge.

I asked this once before and find it strange that Save Presentation  returns and logs an empty string.

 

Many versions of JMP and of Windows OS ago Default Directory seemed to work, but with all the background stuff going on in the PC, JMP changed the behavior of Default Directory. Circa JMP 11, I argued "if the JMP Pick Directory or Save or Open has the last used path, it would be useful to expose that via JSL."

 

When I tried this before, I looked for a method to send a click to the Select Folder button for Pick Directory.

Something like this since the focus in the Pick Directory Window is on the button Select Folder and the path is the last path chosen.  

_xx = Log Capture (Pick Directory() << Click) 

 

But nothing tried was successful.

 

So a wish list item is that Save Presentation writes the file path to the variable or the log. Since it currently writes a blank string to the log and to a variable xx = (rbiv << Save Presentation() );  it does not seem like a big ask.  But better yet offer a  JSL function like Get Path("$Last_Path") as a session a variable.

 

P.S. The example application written for the book has a menu item to Save PowerPoint, so we wrote our own pick directory and file interface for the menu item then used Save Presentation(with the file name).

 

Re: Retrieving a path and filename after Save Presentation() is used with no path specified

Hey, JIm.

 

It looks like Pick File() with the Save option is pretty close to what you describe:

rbiv << Save Presentation( path = Pick File("save", "$TEMP", {"PowerPoint|pptx"}, 1, 1) );
Show( path );
/*:

path = "/C:/Users/wemurp/AppData/Local/Temp/myPowerPoint.pptx";

Hope that helps!

 

Wendy
txnelson
Super User

Re: Retrieving a path and filename after Save Presentation() is used with no path specified

Wendy,

This is extemely close.....

 

Thanks for your brilliance

Jim