02-07-2009 10:03 AM
Attached vi is a routine that is supposed to act as follows:
1) Open a file for manipulation and conversion.
2) Perform calculations to derive velocity and accel values from displacement (this part not shown for simplicity).
3) Open a new file path dialog box that is preloaded with the path as well as default filename (taken from the input file name).
4) Allow the option of changing or adding to the output filename (this made possible by using a 2nd dialog box).
5) Add the proper extensions to the filename and save 3 separate files.
What I have is a vi that asks for an input filename then automatically without user intervention, changes the extensions and saves the output files.
I need to be able to edit the base filname (without extension) before adding the correct extensions but my program does not produce a dialog box at save time.
I'm confident that I need to create another single dialog box for the output file and wire it to all three output file writes. I can't figure out a way to load the default filename into the dialog box or to even install a dialog box that will automatically pop up but not be shown on the screen. This whole vi has to be run as a sub vi and be invisible to the user
except the open file dialog which is a control that is passed to the sub. I think this has something to do with property nodes but I just can't get my hands around it. Could someone help me with this?
Please forgive the style as this is my first LV program.
Solved! Go to Solution.
02-07-2009 11:00 AM
Can you please attach your VI too.
Meanwhile from your description here is what you can do. Most open/Create file VIs don't pop up a dialog box if a valid path is wired to them. In order to change the last part of a path, you have two options. You can convert the path into a string. Then using the string manipulation tools like mid and concatenate you can attach the new extension. A more elegant way to do it is to use the path tools called strip path, and then build path. Look up the LabVIEW help for these functions. If you press Ctrl+H when you are in the block diagram and move over a placed SuB-VI it pops up a context help that explains what a sub VI does.
Please post your findings.
All the best
Amit
02-07-2009 11:36 AM
Very sorry. Forgot to attach.
02-07-2009 11:41 AM
Thanks. I use context help. I have some string functions in the vi already. I can biuld the string I want but I don't know how to force the dialog screen. I sort of need it to work like an unwired path so it will pop up automatically. I don't know how to get inside this "nonexistant" control to attach a property node. So you see I need some behavior of a wired control and some behavior of an unwired control.
02-07-2009 12:13 PM
walter-donovan wrote:...
figure out a way to load the default filename into the dialog box or to even install a dialog box that will automatically pop up but not be shown on the screen. This whole vi has to be run as a sub vi and be invisible to the user
How can you have a popup that will not be shown on the screen? That's a completely contradictory requirement.
If you want a file dialog, use the the File Dialog function.It's on the File I/O>Advanced File I/O palette.
p.s. You also need a while loop around your event structure.
02-07-2009 01:56 PM
Forgive my wording. I don't want the popup to be invisible. I mean that I don't want a separate, visible control on my front panel.
And yes, I know about puting the code into a loop. It is in a nested loop in the actual application.
Did you run my example? If you do you can see that no dialog box opens at the invocation of the save routines. What I want is to
have a dialog box open, already loaded with a default filename. If I add a control to the panel, I will manually have to click on it
to open it. I want it automatically opened since this sub vi is called and should execute to completion without intervention (with
the exception of dealing with the automatically opened dialog box).
02-07-2009 02:46 PM
02-07-2009 03:03 PM
I tried it again, at least what I interpret that you are saying. I put a control on the front panel (I don't think I can put it in the block diagram). Here is the revised vi. It now opens my first input dialog box, processes the info and opens the newly added output file dialog box three times. Each time it is blank. Apparently I misunderstand you.
Using the file I provided, I run the pgm, select the input file dialog box and select "Input Data.txt"
After processing I want one single dialog box to appear with the default file "Input Data.txt". The method I used here invokes the dialog 3 times and there is no defualt name.
02-07-2009 06:45 PM - edited 02-07-2009 06:47 PM
I don't understand why you are finding it so difficult and how you could possibly interpret my suggestion for a function on a palette for a front panel control. If you want a single dialog box to appear, call the File Dialog box function I mentioned twice. A front panel control is not a dialog. It's a control. A dialog box is exactly the function on the File I/O>Advanced File Functions palette. If you don't want to use this dialog box, create your own. If you don't want to use a dialog box, stop saying that you do.
Here is the dialog box function:
02-08-2009 06:21 AM
Thank you for the diagram. Apparently I misread your first post and I was looking for a file path dialog control. Like I said I am very new to LV and don't know every function and control available to me. I assume that this dialog is what I would use if I want to do file ops from a runtime menu?