cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
conroyco
Level I

Saving files to created folder

I am trying to save a journal and pdf to a folder after they are created.

 

First I use pick directory to get the files I want to analyze. When this is done, the files are saving into that directory.

 

However, I want them to save into a folder with the date.

 

This is the code I have tried:

 

Main Menu( "Minimize All" );
path = Pick Directory( "Select a directory" );
Set Default Directory( path );
files = Files In Directory( path );
output = Create Directory( path || Substitute( MDYHMS( Today() ), "/", "-", ":", "." ) || "/" );
 
It then goes into a for loop to create the graphs
At the end of the for loop you have
jrn <<
SaveJournal( path || files[i] || ".jrn" );
Current Journal() << close window();

report << SavePDF( path || files[i] || ".pdf" );
report << close window();
dt << close window;
org << close window; 

For the saved parts, Ive tried path || output|| ... and I've also tried add "/" - none of these seem to work.

 

For now its saving into the directory as far as path, but I want it to go one step further into output

 

1 ACCEPTED SOLUTION

Accepted Solutions
jerry_cooper
Staff (Retired)

Re: Saving files to created folder

I think the issue may be that the assignment of your "output" variable is not producing the result you're expecting. Try this:
output = path||substitute(MDYHMs(Today()), "/", "-", ":", ".")||"/";
Create Directory ( output );

Then, when you go to save your report, the following should work for you:
report << SavePDF ( output || files[i] || ".pdf");

View solution in original post

2 REPLIES 2
jerry_cooper
Staff (Retired)

Re: Saving files to created folder

I think the issue may be that the assignment of your "output" variable is not producing the result you're expecting. Try this:
output = path||substitute(MDYHMs(Today()), "/", "-", ":", ".")||"/";
Create Directory ( output );

Then, when you go to save your report, the following should work for you:
report << SavePDF ( output || files[i] || ".pdf");

conroyco
Level I

Re: Saving files to created folder

Great, just tried it there and it worked !



Thank you






Recommended Articles