10-24-2018 09:02 AM
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?
10-24-2018 09:05 AM
Hi Thomas,
this is a Windows/Microsoft question - you should look for help in MSDN!
This might give some ideas…
10-24-2018 09:14 AM - edited 10-24-2018 09:16 AM
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.
10-24-2018 09:16 AM - edited 10-24-2018 09:23 AM
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?
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...
10-24-2018 09:23 AM - edited 10-24-2018 09:25 AM
10-24-2018 09:33 AM
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.
10-24-2018 10:14 AM - edited 10-24-2018 10:18 AM
@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.
10-25-2018 01:02 AM
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.