LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

double clicking tdms to auto open it in the compiled program

I compiled a labview project to an executable file, say "example.exe"

When I'm running example.exe, I can click to open my tdms data file.

However, I would like the option to double click on the tdms data file, the example.exe would be called to open my file.

(just like when double-clicking docx file from Explorer, Microsoft Word will open)

 

Can someone post a VI here on how to do that?

Message 1 of 8
(2,103 Views)

I don't have a VI to share, but the solution requires two parts:

 

The first is letting Windows know that you have a program to open the file type. You could do this by defining a shell extension / context menu handler to point to your executable: https://learn.microsoft.com/en-us/windows/win32/shell/fa-verbs#register-an-application-to-handle-arb...

 

Inside your VI, you can then access the command line parameters used to call the executable: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHdICAW

 

This way, when the "Open" verb is called on the registered file, Windows executes your executable and adds the file name to the command line parameters. You can then read the path of the file to open and continue from there.

Message 2 of 8
(2,095 Views)

it works beautifully.

ngthai_1-1667054774081.png

 

 

On the 1st part, I did it manually.

 

I'm wondering if there is an option I can modify the Build Specifications so that when I build my "example.exe" or Example Installer, Windows will automatically assign my application to handle tdms file? (i.e., for my users not have to do the 1st part manually).

Thank you.

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

@ngthai wrote:

it works beautifully.

ngthai_1-1667054774081.png

 

 

On the 1st part, I did it manually.

 

I'm wondering if there is an option I can modify the Build Specifications so that when I build my "example.exe" or Example Installer, Windows will automatically assign my application to handle tdms file? (i.e., for my users not have to do the 1st part manually).

Thank you.


Yes, you can, you have to associate your application as the default application for that FileType in Windows Registry

https://stackoverflow.com/questions/316204/how-to-set-an-application-as-the-default-program-of-openi...

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 4 of 8
(2,021 Views)

Thank you. Your suggestions means that my users still need to do "registry entries" manually, which I did and it already worked.

 

My need is: My users, after installing my executable installer, will not have to do any registry changes (in Windows).

My question is: In Labview Build Specs, is there any option to build that registry changes into the installer package?

0 Kudos
Message 5 of 8
(1,995 Views)

Yes, you can configure the necessary registry changes when you build your installer.

 

MIG_0-1667082732028.png

See this thread for some hints on how to do it:

https://forums.ni.com/t5/LabVIEW/Registry-Items-for-Custom-File-Extensions/td-p/4038048

 

0 Kudos
Message 6 of 8
(1,980 Views)

Here is an example I saw years ago.

 

https://forums.ni.com/t5/LabVIEW/How-to-associate-a-file-extension-to-an-executable/m-p/205904#M1169...

 

I also have used InnoSetup for years, and it has a feature where you can have it launch a program with a file extension as part of the installer.

0 Kudos
Message 7 of 8
(1,948 Views)

FYI, you can definitely break stuff if you mess with the registry. Definitely make a backup using regedit before you change things, otherwise you could wind up not being able to open folders anymore 🙂

 

See this thread for some info:

 

https://forums.ni.com/t5/LabVIEW/Adding-a-key-to-the-registry-clears-Default-values-Adding-to/m-p/42...

 

0 Kudos
Message 8 of 8
(1,931 Views)