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

Rename data table from a subsection of the file path.

I use Pick File() to retrieve the file path. From this file path I want to take a subsection and use this as the name for the data table produced by the script.

For example the file path is C:\Documents\Plot_Losses\DUT2\25C\filename and I want to call the data table 25C. 

 

I can use Set Name to name the data table as the whole file path but not a subsection.

How can I script this for when the temperature folder changes the name of the data table changes too.

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Rename data table from a subsection of the file path.

Then you can most likely use Word() with -2 as the index (searches from the end) (-1 would be the filename)

Names Default To Here(1);

filepath = "C:\Documents\Plot_Losses\DUT2\25C\filename.jmp";
foldername = Word(-2, filepath, "\");
show(foldername); // foldername = "25C";
-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Rename data table from a subsection of the file path.

Which part do you want to use? Is it always the folder name before filename?

-Jarmo

Re: Rename data table from a subsection of the file path.

Yes its always the folder before the filename

jthi
Super User

Re: Rename data table from a subsection of the file path.

Then you can most likely use Word() with -2 as the index (searches from the end) (-1 would be the filename)

Names Default To Here(1);

filepath = "C:\Documents\Plot_Losses\DUT2\25C\filename.jmp";
foldername = Word(-2, filepath, "\");
show(foldername); // foldername = "25C";
-Jarmo

Re: Rename data table from a subsection of the file path.

This works great, thank you