cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
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