postformac Posted May 4, 2009 Report Share Posted May 4, 2009 Hi, I am collecting some data and saving it to a csv file for analysis in Excell, is there some way to set the default file extension that the data gets saved as? I can set it to save in csv format, but when I get the dialogue box asking where to save the file it always defaults to "All Files (*.*)" as the file type and you have to manually enter .csv on the file name. Thats not a problem as long as you know to do it but I want to make it so that it defaults to *.csv so that when other people use the program they won't get it wrong and end up with a file they can't open. Thanks! Quote Link to comment
LAVA 1.0 Content Posted May 4, 2009 Report Share Posted May 4, 2009 The 'File Dialog' express VI has an input called pattern (all files) setting this to *.csv will default the files with an extension of csv. By using this input and the accompanying pattern label you can mimick your own filetypes. For instance you could set pattern label to Measurement files. If you have a path control you can set the browse options to achieve the same effect. However I advise you not to use text based files for Excel, either write directly to excel via the ActiveX interface, or save your data as TDMS and use the Excel TDMS plugin to open the file. This will prevent errors from localization. Ton Quote Link to comment
ShaunR Posted May 4, 2009 Report Share Posted May 4, 2009 Open your own dialogue prompt (File I/O>>Adv File funcs>>File Dialog) and pass the filepath to the save vi. The File dialogue express VI enables you to set the default extension and passing the filepath means that the default dialogue won't be invoked. Quote Link to comment
postformac Posted May 4, 2009 Author Report Share Posted May 4, 2009 Brilliant, thanks guys that works perfectly. Quote Link to comment
ShaunR Posted May 4, 2009 Report Share Posted May 4, 2009 QUOTE (Ton @ May 3 2009, 02:51 PM) The 'http://zone.ni.com/reference/en-XX/help/371361E-01/glang/file_dialog/' target="_blank">File Dialog' express VI has an input called pattern (all files) setting this to *.csv will default the files with an extension of csv.By using this input and the accompanying pattern label you can mimick your own filetypes. For instance you could set pattern label to Measurement files. If you have a path control you can set the browse options to achieve the same effect. However I advise you not to use text based files for Excel, either write directly to excel via the ActiveX interface, or save your data as TDMS and use the Excel TDMS plugin to open the file. This will prevent errors from localization. Ton LOL. Looks like you pressed the send button just before me Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.