Subscribe Bookmark RSS Feed

file selection in script

olivia_manning

Community Trekker

Joined:

Jun 20, 2012

I have written a script for data analysis (on multiple text files) and for this to work I need the user to select text files and rename them, pick one reference file and then I have to get the filePATHS back to my script.

I have written the joint script to start off with but the problems I am having are:

1. It's only sending back the file NAMES whereas I need the file PATHS

2. It is not possible to rename the files (without changing the filepath)

3. The user cannot select a reference file

Anyone have any idea on how I could do all of this?

Thanks for any help

3 REPLIES

Hi Olivia - one quick question: do you want to rename the files individually, or do you need some sort of batch renaming capability?  If you want to rename them individually, there's a script and corresponding add-in in the "Utilities" section of the JMP File Exchange called "Data Set Contents" (there's also a copy of it attached to this post) which summarizes any JMP data set contained in any selected folder, and allows the user to rename the data set, along with a few other capabilities like copying and deleting.  I saw your earlier post and unfortunately I haven't had time yet to have a go at this myself, but it ought to be possible to modify that script to make it display and summarize a list of .txt files instead of JMP data sets - so you could maybe adapt part of the script to perform the renaming operation you need.

On one of the other points, the "DataDirectory" variable contains the path of all the files in the text box (it was set when you navigated to that directory), so you can just prepend that to each of the names in turn to get the full paths.

Regarding the reference file, you could set a single reference by populating a second list box with the same file names, and then adding a "max selected(1)" option to it: that would enable you to allocate just one reference file.  You would then presumably just add a "Run" button box to perform the actual analysis once all the required choices had been made.

Does that help at all?  If I can help with any of the specifics regarding the actual scripting, just let me know and I'll see what I can do.

Best regards,

David

olivia_manning

Community Trekker

Joined:

Jun 20, 2012

Hi David,

Thanks for taking the time to look at that.

I'll have a look at the renaming, I might have found a way of getting around having to do it at all.

The problem is that I'm using the data in the txt files to draw up other data tables and then graphs, JMP fills in the titles and legends automatically and I'd like to be able to modify them (I'm not sure if I'm being very clear...). This is the kind of thing I've got:

nw = New Window("Associated Graphs",<<Modal,

                           V List Box(Align(center),

                                           Graph Builder(...);

                                           H List Box (Bivariate(...), Bivariate(...);

                              )

I have found out how to change the title but have you any idea how I could modify the legend in the Graph Builder graph (I'm not too worried about the bivariates)?

I had thought of using the "DataDirectory" and  "TxtFilesList" but I can't seem to find a way of putting them together to have the filepath... What function do you think I could use for that?

For the reference file that worked perfectly, thanks a million!

Regards,

Olivia

Hi again Olivia - one very quick reply on the file path question: to concatenate two text strings, just use DataDirectory || TextFilesList to create a single string consisting of the one followed by the other.  I'll have a think about the other questions and come back with any answers when I can if nobody else replies first.

Cheers,

David