cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Security Notice: CVE-2026-109618 and CVE-2026-109619

    JMP promptly initiated a review of its products, services, and relevant infrastructure for exposure to CVE-2026-109618 and CVE-2026-109619.

    Our assessment of JMP products has not identified exposure to these vulnerabilities. Where remediation was required within supporting environments, appropriate security updates and controls have been applied and validated.

    We have identified no evidence of successful exploitation or unauthorized access to JMP systems or customer information associated with these vulnerabilities.

    JMP continues to monitor the issue and relevant vendor guidance. No action is required by JMP customers at this time.

  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.

Discussions

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

JMP 16: Script to open most recent .csv file in a folder.

I have been using the path = Pick File(); command to manually select the file to import into a data table. Can you script a command to import the most recent .csv file in a folder to a data table? There is only one worksheet in these files.

4 REPLIES 4

Re: JMP 16: Script to open most recent .csv file in a folder.

Did you search Functions in Help > Scripting Index and examine the File group of functions?

 

 

file.PNG

 

You could base a script on the Creation Date() or the Last Modification Date() functions.

WoHNY
Level IV

Re: JMP 16: Script to open most recent .csv file in a folder.

Mark: Thank you for the response. I wasn't aware of the Scripting index under help so that is big help going forward. I was referencing a pdf version of a JMP15 Scripting Guide that is not search friendly. One issue I have with the file name is that it includes the time stamp at the end of the name, so it is dynamic. The format is FileName_YYYYMMDDHHMM.csv. I will stick with PickFile for now and experiment with the LastModificationDate function. Thanks again.

Re: JMP 16: Script to open most recent .csv file in a folder.

You can match the file name with the Contains() function if you want to ignore the time stamp.

Re: JMP 16: Script to open most recent .csv file in a folder.

I just happen to have had this need in the past, and luckily saved a script just in case...

You'll need to change the strings on line 2 and 3.

Names Default To Here( 1 );
searchext = "jmp"; //extension to look for
searchfolder = "$DESKTOP"; //place to search

lstExtensions = {};
lstDates = {};
lstFiles = Files In Directory( searchfolder );
For Each( {i, j}, lstFiles,
	lstExtensions[j] = Char( Right( i, 3 ) );
	lstDates[j] = As Date( Creation Date( searchfolder || "/" || Char( i ) ) );
);
dt = New Table( "Files",
	New Column( "Name", character, set values( lstFiles ) ),
	New Column( "ext", character, set values( lstExtensions ) ),
	New Column( "Date", numeric, set values( Matrix( lstDates ) ) )
);

dt << Select where( :ext != searchext );
dt << Delete Rows;

newest = Col Min( :Date );
newfile = searchfolder || "/" || :Name[dt << Get Rows Where( :Date == newest )][1];
Close( dt, no save );
Open( newfile );

Recommended Articles