LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Porblem in picking files with path and then save into a text file

I am building a vi, which can show files one by one from a selected folder, and save some files into text.txt, which I am interested and also do something else with it. However, when I press "SAVE" Button, I often miss file I want, but saved one after. It seems a timing problem. Please help.
0 Kudos
Message 1 of 10
(3,605 Views)

Hi,

What version of LabVIEW do you have? You can use the Events Structure instead of the For Loop. This will ensure that your user events (button clicks) won't be missed. See attached diagram.

There's a Timeout event (not shown in the diagram) which does nothing but is required since you wire the 3000ms to it.

A general tip: Use Execution Highlighting (light bulb on the diagram toolbar) to study how a particular VI executes.

Hope this helps.

Regards,

Khalid


Message 2 of 10
(3,605 Views)
Thank you for help. I still can not make it work.

Problem 1: Timeout input is wired,but timeout event is not handled.
Problem 2: I want select the file I have interest in, not all files in selected foldor.
0 Kudos
Message 3 of 10
(3,605 Views)
It is really not a good idea to go through an unknown number of files in a timed manner, 3 seconds is a long time per file! It will forever for big folders and requires constant attention. What if the phone rings in the middle of the operation?

This is not a video game!

I suggest something as in the attached example.
(1) read all files into a listbox.
(2) let the user select 0, some, or all files.
(3) pressing save writes all selected files in one step.

Note that I put the actual "save" operation into a case for debugging. Instead, It only displays what it would write to file. Just change the boolean for the case if you actually want to save to file.

Happy wiring!
Message 4 of 10
(3,605 Views)

You should add a Timeout event to solve problem 1.

Anyways, what Altenbach suggests is indeed the right thing to do. Waiting for the right file to come up and then clicking it within 3 seconds does sound like a video game!!

Regards,

Khalid

0 Kudos
Message 5 of 10
(3,605 Views)
I think I did not make your fellow understand my goal. I add more to my Vi, which intends to automatically show all graphs (from the files of selected folder). Once I see a graph is what I want, I click "SAVE" and want this filename with path be saved in a text file. Finally, I will get all interesting files from this selection.
If I see a interesting graph, I could pause VI and then decide if saving it, that would be perfect.
Please comment and help. Liming
Download All
0 Kudos
Message 6 of 10
(3,605 Views)
OK, here's an inproved suggestion. (You should REALLY not show the files in a timed fashion, this is too annoying to the user.)

I suggest to show the first file, then the user presses "skip" of "save", then the next graph appears.

Optionally, you can keep track of what's saved in a boolean array and allow the user to scan forward and back through the files. Attached is a rough example, try it!

(I only spend a few minutes on this, so there might be a few bugs, but you'll get the idea. Modify as required).
Message 7 of 10
(3,605 Views)
Thank you very much. It works great when I move "SAVING" into Event Structure and change the Constant for saving case as TRUE. Only thing not working is "save already button", it seems does nothing.
0 Kudos
Message 8 of 10
(3,605 Views)
"Already saved!" is just an indicator that shows if a spectrum has been saved already in the current session (e.g. if you "save" and then press "Previous"). Check the code. (Notice that the "save" button gets disabled whenever a spectrum is already saved. You can do many variations of the theme, I just show a few simple suggestions).
0 Kudos
Message 9 of 10
(3,605 Views)
Great idea. Thank you very much. I am happy now
0 Kudos
Message 10 of 10
(3,605 Views)