LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a LabVIEW application the default viewer of TDMS files?

I built a simple TDMS reader as an alternative to Excel TDMS plugin. I found that LabVIEW supports drag and drop feature on path control, which is cool, but I still have to run the application manually at the beginning. The next step is to directly run the application when any TDMS file is opened - to make this app the default TDMS viewer. How do I accomplish that?

0 Kudos
Message 1 of 8
(2,687 Views)

Hi Thomas,

 

this is a Windows/Microsoft question - you should look for help in MSDN!

This might give some ideas…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(2,684 Views)

Nonono, I know how to do that. The question is not how to request opening file with a random app in Windows (I can always use "Open with..." dialog right?), but rather how to prepare a LabVIEW app to handle such request correctly - to take the path of the file opened and paste it in the specified Path control. I believe there must be a LabVIEW support for that, but I cannot find any kind of documentation related to it.

0 Kudos
Message 3 of 8
(2,679 Views)

First thing this will only work with a compiled LabVIEW executable not a "vi". Because you can only associate exicitubules (.exe) not vi's with file types. Besides what good would opening the LabVIEW development environment do?

 

  1. Open a file explorer window
  2. Left click once on a file to select it
  3. Now Control + RIGHT click on the file
  4. In the pop-up menu there will be a selection called "Open With..."
  5. Select that and it will bring you to the screen where you can select what program opens a certain file extension by default

Well that's what it sounded like you wanted. 

 

 wrote:

Nonono, I know how to do that.... but rather how to prepare a LabVIEW app to handle such request correctly - to take the path of the file opened and paste it in the specified Path control. I believe there must be a LabVIEW support for that, but I cannot find any kind of documentation related to it.

I have to say I do not understand what you are asking here...

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 8
(2,677 Views)

Hi Thomas,

 

how to prepare a LabVIEW app to handle such request correctly

Use the "Application.CommandLineArguments" property…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 8
(2,665 Views)

Right now the app has a Path control on the Front panel and when I drag and drop the file in it, the path of the file gets pasted in it. There is an event structure waiting for it and then it shows the contents of the file. Perfect.

 

I can of course right click the TDMS file and then "Open with...", but when I do so, the app has no idea what to do with the file. I didn't specify what should it mean for the app to open tdms file. The app doesn't know that it should take the path provided by Windows, check if it is a TDMS file and paste it in the Path control. When I open the file this way, nothing happens.

0 Kudos
Message 6 of 8
(2,650 Views)

@Thomas444 wrote:

Right now the app has a Path control on the Front panel and when I drag and drop the file in it, the path of the file gets pasted in it. There is an event structure waiting for it and then it shows the contents of the file. Perfect.

 

I can of course right click the TDMS file and then "Open with...", but when I do so, the app has no idea what to do with the file. I didn't specify what should it mean for the app to open tdms file. The app doesn't know that it should take the path provided by Windows, check if it is a TDMS file and paste it in the Path control. When I open the file this way, nothing happens.


Ah... Well I think GerdW is pointing you in the right direction. As I believe the "Open with..." and when a file type is associated with a program, in the background Windows builds a command line and feeds it to the application with the file you are opening as a command line argument. 

 

So your application has to be written to properly handle the file command line arguments.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 8
(2,630 Views)

Thank you guys, that is exactly the point I was missing - I had no idea that it has something to do with command line arguments. Works good now.

0 Kudos
Message 8 of 8
(2,609 Views)