LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

WriteToTextFile -- how to prompt ONCE??

how do i get (text) File I/O VI's to prompt
only ONCE for a filepath and then use that
from then on?

if i leave FilePath unwired, (because i want
the user prompted) i get prompted for
file location on EACH ITERATION, even with
"Append" wired True. that is, the data is being
appeneded, but it constanly brings up the file dialogue box.

i want it to come up only the first time upon program
execution.

-tony
0 Kudos
Message 1 of 4
(2,884 Views)
Put a shift register on the loop containing the file write function. Connect the left shift register node to the file path input to the write vi. Connect the file path output from the write vi to the right shift register node. Do NOT initialize the shift register.

The first time you run the vi, the shift register will contain an empty path and so prompt you for a file to write. The path to the resulting file will be put into the shift register so the 2nd time through the loop the routine won't ask for a file name.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 4
(2,884 Views)
Also it's possible to use local variables. They are useful when you don't use loops, but need to save data in several places of your code.
In this case the default value of your path variable must be "Not a path" if you want to get prompt first.

Oleg Chutko.
0 Kudos
Message 3 of 4
(2,884 Views)
I had this exact problem not too long ago. I don't know how elegant this solution is, but I simply added another while loop around my main program and the user prompt.
0 Kudos
Message 4 of 4
(2,884 Views)