cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Alex19
Level I

How to select (but not open) file in a directory?

Hi All,

I'm trying to select a specific file in a directory:

Alex19_0-1678302880241.png

This is probably a huge code, but I don't even know how to start. Does anybody know the command how to SELECT (but not open) a specific file? If someone can provide more code - it would be greatly appreciated.

Thank you!

Alex.

 

1 ACCEPTED SOLUTION

Accepted Solutions
StarfruitBob
Level VI

Re: How to select (but not open) file in a directory?

Hello @Alex19,

 

Could you explain what you mean by select?  Using Pick File(), as @Jed_Campbell suggests, but save the resulting path to a variable, you can call upon it on other areas of your script. Below is an example.

mypath = Pick File( "Select a file", "$Desktop" );

show( mypath );

Edit:

Have you investigated Move File()?  Together with Pick File(), you will be able to accomplish what you've outlined.

StarfruitBob_0-1678307691529.png

 

Learning every day!

View solution in original post

5 REPLIES 5

Re: How to select (but not open) file in a directory?

I think Pick File () is what you're looking for.

Jed_Campbell_0-1678304440674.png

 

 

Alex19
Level I

Re: How to select (but not open) file in a directory?

 Thanks Jed. I have looked at this one, but it does not select the file on the drive. It suggests to open it:

Alex19_0-1678306017598.png

What I generally want is to sort out a large set of files based on their properties. For example:

1. From JMP table select files 2 and 4,

2. Run the script to select only files 2 and 4;

3. Move those files in a different directory. 

Maybe there is another way?

Thanks!

 

StarfruitBob
Level VI

Re: How to select (but not open) file in a directory?

Hello @Alex19,

 

Could you explain what you mean by select?  Using Pick File(), as @Jed_Campbell suggests, but save the resulting path to a variable, you can call upon it on other areas of your script. Below is an example.

mypath = Pick File( "Select a file", "$Desktop" );

show( mypath );

Edit:

Have you investigated Move File()?  Together with Pick File(), you will be able to accomplish what you've outlined.

StarfruitBob_0-1678307691529.png

 

Learning every day!

Re: How to select (but not open) file in a directory?

There's also the List Files in Directory function that can be useful.

lstFiles = Files In Directory ("$DESKTOP/");

The Scripting Index has a bunch of file-related functions. To see them all, Select "File" in the left pane:

Jed_Campbell_0-1678307860003.png

 

Alex19
Level I

Re: How to select (but not open) file in a directory?

Yes, I'm actually working on Move File now. I think I'll create a string to move all the selected files. It should work. Thanks!