Open files using contains ()Hi all,
I am try to create a script that would go through directories to find the input file. However, some file names may have different characters.
For example:
My input in favorite fruit would be: Orange
Existing files from folder would be: Mark_Orange_Mango.jmp, Jane_Apple.jmp, John_Orange.jmp
Files that would open: Mark_Orange_Mango.jmp and John_Orange.jmp
How can I open these files using contains() or what function do I need to use? I am using JMP 15
Here is the piece of code I am working on:
nw = New Window( "Favorite Fruits", << modal(),
lineupbox(ncol(2), spacing(5),
Text Box( "Name:" ),
teb1 = Text Edit Box( "", <<SET width=""></SET>
Automation and ScriptingWindowsRe: Open files using contains ()See if this works for you
nw = New Window( "Favorite Fruits",
<<MODAL>= 1, i--,
If( Word( -1, files[i], "." ) != "jmp",
Remove From( files, i, 1 )
)
);
If( N Items( Files ) > 0,
tableList = {};
For( j = 1, j <= N Items( files ), j++,
If( Contains( files[j], fruit ) > 0, // Open file that contains the input from text box
dd = Open( path || "/" || files[j] );
Insert Into( tableList, dd );
)
);
);
</MODAL>Re: Open files using contains ()Hi, its not working on my side. Is this applicable on JMP15?
Re: Open files using contains ()It can be as complex as you want it to be
If(
(Contains( files[j], fruit ) & Contains( files[j], "Good Luck" )) |
Contains( files[j], "Special" ),
dd = Open( path || "/" || files[j] )
)
I strongly suggest you take some time to read the Scripting Guide. It will make your journey into scripting far more pleasent.