LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stuck in loop creating a new file

Well, I already posted this under my "Report" versus "File" thread but starting a new thread seems to get a faster response, so here I go again...on my own...walking down the only road I've ever....Sorry!


I set up a simple "create new file" procedure and it's not working right. I put in an "Open/Create/Replace File" tool in my program, wired a 2 to the "function" (tells the tool to create a new file or replace an existing file) and wired a string value to the "default name". All other inputs I left default. The next tool I placed was the "Write File" tool and I just wired the refnum and error out from the previous tool into the "Write File" tool and I also wired a test string into the "data".

When I run the program, a pop up window comes up prompting me to enter the name of the file to "Save as". This pop-up window continues to come up, regardless of what I enter and I can't get out of the loop. Why does it not seem to accept the name of the new file and keep prompting me to re-enter it?
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 1 of 6
(3,411 Views)
I did exactly what you told you did in your post. It seems to work okay for me.

Are you running this vi as a standalone or as a subVI?

deepak
0 Kudos
Message 2 of 6
(3,394 Views)
Hi,

to understand your problem, you do not use any kind of loop-structure in your program, and the save as dialog window continuously comes up?

geotos
0 Kudos
Message 3 of 6
(3,393 Views)
There first thing you should do is go to the help menu and select Show Context Help. This will display a Context help window. I've been programming LabVIEW for a lot of years and I still have to have this window open. Clicking on the link in the context window will display additional help. The help explains that if you leave the path unwired, you will always get a dialog box. The default name is not enough. Passing a valid path to Open/Create/Replace will eliminate the file dialog pop-up but if you always do a replace file, you will also need to wire a bollean false to the advisory dialog input so you won't get another pop-up asking are you sure that you want to replace the file.
Message 4 of 6
(3,389 Views)
Whoops! It was me! I placed the file logic inside one of the cases in a stacked case structure where it keeps hopping back to that same case. Normally it continually loops inside that case waiting for the operator to select one of several buttons, and I realized that was a bad place to put it. I placed it inside another case structure that didn't loop repeatedly and it worked fine. Thanks for the info!
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 5 of 6
(3,381 Views)
Good advice as always Dennis..

😄
0 Kudos
Message 6 of 6
(3,378 Views)