cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • 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!
  • See how to use the JMP Marketplace – Free tools to expand JMP capabilities. Register. July 10, 2 pm US Eastern Time.

Discussions

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

How do I get JMP to close pdf files that have been opened to extract information?

Since I am new to scripting, I just copied a script from a previous discussion (https://community.jmp.com/t5/Discussions/Batch-processing-files-to-extract-data-into-a-summary-table...) and slimmed it to the stuff I need - only the pdf file names.

Names Default to Here( 1 );
//point to file directory

path = Pick Directory( "Select Directory Containing Data Files" );

//Gets the list of files in the selected file folder
file_list = Files In Directory( path );

// Create beginnings of output data table
dtFinal = New Table( "Final", New Column( "File Name", Character ));

//i=0;open file
nfile_list = N Items( file_list );
For( i = 1, i <= nfile_list, i += 1, 
	//Set Current Directory( dir_DirectoryPath );
	dt = Open( path || file_list[i], );
		// Add information to Final data table
	dtFinal << add rows( 1 );
	dtFinal:File Name[N Rows( dtFinal )] = file_list[i];
);

Unfortunately, I have about 750 pdf files which all open while running the script.

Does anybody know how to automatically close the pdf files?

 

Thanks a heap for your help 

 

 

2 REPLIES 2
mmarchandTSI
Level V

Re: How do I get JMP to close pdf files that have been opened to extract information?

It doesn't look like there's any need to open those pdfs in the first place, since all your script is doing is putting a filename in each row of :File Name.

Names Default to Here( 1 );
//point to file directory

path = Pick Directory( "Select Directory Containing Data Files" );

//Gets the list of files in the selected file folder
file_list = Files In Directory( path );

// Create beginnings of output data table
dtFinal = New Table( "Final", New Column( "File Name", Character ) );

//i=0;open file
nfile_list = N Items( file_list );
For( i = 1, i <= nfile_list, i += 1, 
	//Set Current Directory( dir_DirectoryPath );
	//dt = Open( path || file_list[i], );
		// Add information to Final data table
	dtFinal << add rows( 1 );
	dtFinal:File Name[N Rows( dtFinal )] = file_list[i];
);

 

But you could do it even quicker and more efficiently.

 

Names Default To Here( 1 );
path = Pick Directory( "Select Directory Containing Data Files" );
dtFinal = New Table( "Final", New Column( "File Name", Character, Set Values( Files In Directory( path ) ) ) );

Re: How do I get JMP to close pdf files that have been opened to extract information?

Thank you so much for helping me on this issue.

Much simpler and exactly what I wanted.

Happy to be in this community.

 

Have a great day :)

Recommended Articles