LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving a file -> Save as type

I would like to have a file-save dialog with the standard drop-down list with pre-defined file types as seen in most programs today. However, in LabVIEW I cannot find a simple way of doing this. Any suggestions?
0 Kudos
Message 1 of 12
(4,828 Views)
If you look at the FileDialog-VI (file-advanced) you can define with
"pattern" file-types (multiples with semicolon between).

Niko
0 Kudos
Message 2 of 12
(4,828 Views)
Niko,
Thanks for your response. With the pattern I can screen the files that are visible in the dialog. This is only half the problem though.

What I would like to do is to have an output from the dialog that tells me what the user selected so that the program can save in that particular format. To give you an example. I would like to have a drop-down list with three formats e.g.: .aaa, .bbb and .ccc.

When confronted with the file save dialog the user can select what format he/she wants and then the program acts accordingly.

This is the same as if you were to save a picture in .bmp, .jpg, or .tif format using a photo editor. The program needs to know what was selected and then process the data accordingly before the file finally is written to
disk using the correct file extension. Can this be done?
0 Kudos
Message 3 of 12
(4,829 Views)
Mikael,

Looks like you are going to have to create something. I am sure that someone out there has already done this, but unless they ante up, you are going to either have to search this tool out, or create your own.

Take a look at the file writing VIs, and the file manager. This will give you a basis on which to work. Basically, create a front panel that is similar to common file dialogs (or create your own). Then you add an enumerated type or text ring of the file extensions and descriptions (this is often neglected in windows, but great software such as Photoshop and IMAQ Vision Builder always include the description.) Speaking of which, if you have IMAQ VB, take a look at their file dialog. It's an excellent example of what you can
do, although I personally like the look of Photoshops UI.

Good luck, and be sure to let us know how you do.
0 Kudos
Message 4 of 12
(4,829 Views)
LabVIEW-guru,
Thanks for your suggestions.

Before I posted this question I was actually contemplating on writing my own VI for doing this. I started the effort but soon I decided to not continue. Why? Well, why did I want this functionality in the first place?

My goal is to have a LabVIEW application that does not shine “I am written in LabVIEW”. With LabVIEW 6i it is almost possible to do this. Almost. I am a Die Hard supporter of LabVIEW and I am more than happy with the power LabVIEW 6i gives me in creating programs for controlling my measurements.

Ok, so what options did I have for this particular application. The obvious solution is to first have a pop-up dialog that asks for the desired format. The program
then uses this information when calling the standard dialog for saving a file. However, doing this leaves behind a sense that this is a home-brew solution. The suggestion you had of writing my own VI seems the best way to do it. But! The listbox, that one needs to list the directory, with its symbols does not look exactly as the windows equivalent. I have not figured out how to get the symbols in color. Also, I faced problem with the dialogring used at the top for selecting higher level directories. It seems that I cannot use symbols in it. Those two problems defeat the purpose by writing my own VI. If I can’t get it to look like a standard save-dialog, I might as well go for the fist solution, which is by far easiest, using an extra dialog asking for the file format.

But who knows... in LabVIEW 7i (?) I might be able to just wire an array of strings to the file dialog to be used for the Save-as-type selection.... If NI is listening...this would be a neat feature!!

Thanks a
ll for being part of DE! It is a big help for us all! /Mikael Garcia
0 Kudos
Message 5 of 12
(4,829 Views)
> Before I posted this question I was actually contemplating on writing
> my own VI for doing this. I started the effort but soon I decided to
> not continue. Why? Well, why did I want this functionality in the
> first place?
>
> My goal is to have a LabVIEW application that does not shine “I
> am written in LabVIEW”. With LabVIEW 6i it is almost possible to
> do this. Almost. I am a Die Hard supporter of LabVIEW and I am more
> than happy with the power LabVIEW 6i gives me in creating programs for
> controlling my measurements.
>

The LV functions attempt to make many instrumentation and programming
solutions easy. When you find that something is missing, you have
several solutions. One of them that hasn't be
en talked about yet is
to use what the OS provides. Use the system file dialog. There are
hundreds of DLLs on the computer for bringing up file dialogs, making
list boxes, etc.

It will be more difficult than using the LV dialog. There may be version
problems. It may require writing your own DLL to handle callbacks or to
massage parameters. To make this simpler, you may decide to use some
VB code or some other tool that simplify the work needed.

LV is quite open allowing you to use OCXes, Active X automation interfaces,
DLLs, etc. The reason for this is to allow those who need something not
yet supported to be able to develop it if the need is worth the effort.

If it is worth it in this case to have a customized file dialog, then I'd
recommend using the OS features before rewriting the functionality over
again inside of LV.

Greg McKaskle
0 Kudos
Message 6 of 12
(4,829 Views)
Gregg,
Thanks for your suggestions. I just wish I knew how to turn your ideas into code... I already knew that with DLLs/ActiceX you can do amazing things. If you know how to do it that is. I do not, and that is the reason I posted this question in the first place.

If you have an example that shows how this can be done, I would be more than happy if you attached it here. However, from reading your response it seems not to be a simple task and then I think it is better to have this second dialog asking for the file type. It is simply not worth the effort if it is going to be a time-consuming implementation.

Finally, from the responses here I have learned that this function currently is missing in LabVIEW. I was
not sure about this when I posted the question but now I know that is the case. If someone is willing to share code on how to do this thing in LabVIEW using DLL calls or by other means, please let us know in this thread.

Again, thanks for your responses here. /Mikael Garcia
0 Kudos
Message 7 of 12
(4,829 Views)
If you are using windows you can you the common dialog active-x control to call the windows saveas dialog. See if the attached file helps... The filter index indicator displays the index of the file type selected.

Brian
Message 8 of 12
(4,829 Views)
Brian,
What can I say... THANKS!!!! 🙂 This is what I call a first class solution!! It is simple, efficient, and above all, a slam dunk! Thanks again Brian!!!! /Mikael
0 Kudos
Message 9 of 12
(4,829 Views)
Glad I could be a help! I actually tried to post this yesterday but Developer Exchange wouldn't let me log in...
0 Kudos
Message 10 of 12
(4,829 Views)