LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop info and start loop over when file not found.

I have a program that I want to run in a loop as long as there are files in a certain dir. When all the files have been read they are moved to another dir. I want this program to have a continuous loop but when the "read characters from file.vi" is send a "Not a Path" I dont want to be prompted for a file because there can be no user interaction. When my program has read and anylized all the data, I want it to keep going in a loop so when more files are put in this dir it will read again.
0 Kudos
Message 1 of 4
(3,104 Views)
Put a compare if equal or compare if not equal. Compare your path coming in and "Not a Path". Wire the output to a CASE. In your case, put your "Read Characters from File" fucntion.

This way, when all files have been processed and moved, the program would do skip the "Read Characters from File" function until there's more files to process.

Hope that helps.

Shan Pin Koh
0 Kudos
Message 2 of 4
(3,104 Views)
You'll have to write your own VI that doesn't use Open File+.vi or uses a modified version of it. Open File+.vi calls the File Dialog function when the path is empty. Instead, what you need to do is trap the error code generated by an empty path and skip the file read and file close. If you modify one of these VIs, make sure you call it by a different name and store them in a new location.
0 Kudos
Message 3 of 4
(3,104 Views)
Hi,

create a while loop and use the file/directory-info vi (file i/o ->
advanced) to get the list of existing files. If files exist (case structure)
iterate through every one by using a for loop. Now you can read all files
and when finished move them into the new directory. After that you can
analyze the whole data. At last leave the case to wait until the next files
are stored in the directory. Cause you used the file/directory-info vi, you
won't get the dialog!

hope that will help
Henrik

Bobca schrieb in im Newsbeitrag:
50650000000800000040250000-993342863000@exchange.ni.com...
> I have a program that I want to run in a loop as long as there are
> files in a certain dir. When all the files have been read they are
> moved to another dir. I want t
his program to have a continuous loop
> but when the "read characters from file.vi" is send a "Not a Path" I
> dont want to be prompted for a file because there can be no user
> interaction. When my program has read and anylized all the data, I
> want it to keep going in a loop so when more files are put in this dir
> it will read again.
0 Kudos
Message 4 of 4
(3,104 Views)