LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I handle files that were opened using my LabVIEW application?

Solved!
Go to solution

Hi!

 

I want to put some code in my LabVIEW program that will let it handle a file that it was opened with.  Lets say I build my application as a .exe.  I have my .exe associated with a particular filetype in Windows.  If the user double clicks the file, it will launch my labview application.

 

How do I get the file path information of the file that the user clicked on in my code so I can handle it?

 

Thanks for your time!

-nic

0 Kudos
Message 1 of 18
(3,271 Views)

Ohhh....

 

SuperSecretPrivateSpecialStuff=True 

 

Of course. 😛 

0 Kudos
Message 2 of 18
(3,262 Views)

Hello,

 

I thinks you can create a file in LabVIEW which contains the path and name of the file it opened.

 

Then you can use this file to determin which file has been opened

 

Best Regards

Hu Yu
0 Kudos
Message 3 of 18
(3,252 Views)

Huh?

 

I have no idea what the SuperSecretPrivateSpecial Stuff or a comment about LabVIEW creating files has to do with what I think is being asked in the original message.

 

My understanding is you have created an .exe.  You want to be able to double click on a file that you have given a special extension to so that it opens up your .exe and your .exe works with that file.

 

Is that correct?

 

First, you would need to associate the file extension with your executable through Windows.

 

Second, in your LabVIEW program, look at the Application.Command Line Arguments property.  If you use that, you should be able to see what file caused the executable to get launched.  Then you can use that information to do whatever you want with that file in your application.

 

Please note that I have not done this myself before, so there may be some issues with doing this that I'm not aware of.

 

I'd recommend searching the forums for "command line arguments" to see a bunch of different threads discussing this.

Message Edited by Ravens Fan on 01-28-2010 11:56 PM
Message 4 of 18
(3,247 Views)

In LabVIEW 8.2 it is possible to utilize a private event (made visible by the INI setting) named 'OS Open Document', see this page for more info.

 

Please vote here for support on this util.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 18
(3,231 Views)

Ravens Fan's method does works: 

 

OpenApp.png 

 

This can open a JPEG picture.

 

NOTE there must be a configuration in build specification

 

OpenAPP.JPG

Best Regards

Hu Yu
0 Kudos
Message 6 of 18
(3,227 Views)

NIhuyu wrote:

Ravens Fan's method does works: 

 



Yes, but only for the first file (when the application is not open yet).

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 7 of 18
(3,216 Views)
Solution
Accepted by Laura F.

@Ravens -

 

If you put:

 

SuperSecretPrivateSpecialStuff=True 

 

In your LabVIEW.ini file, it will unlock an "OS Open Document" event to use in an Event Structure block with a "File Path" node on the left-hand side.  Whenever the application is launched via a file in the OS, this event is fired (even if your application is already up-and-running).

 

Works like a champ and is fairly straightfoward! 🙂

 

This method was posted in the forums at JKI.

Message Edited by Nickerbocker on 01-29-2010 04:07 PM
0 Kudos
Message 8 of 18
(3,173 Views)

Nickerbocker wrote:

@Ravens -

 

If you put:

 

SuperSecretPrivateSpecialStuff=True 

 

In your LabVIEW.ini file, it will unlock an "OS Open Document" event to use in an Event Structure block with a "File Path" node on the left-hand side.  Whenever the application is launched via a file in the OS, this event is fired (even if your application is already up-and-running).

 

Works like a champ and is fairly straightfoward! 🙂


 

That's good.  But your post #2 where you mentioned it gave absolutely no details.  But if you feel you gave enough information there that could help someone else in the future that you could mark your own message as the solution ......
0 Kudos
Message 9 of 18
(3,164 Views)

Nickerbocker wrote:

@Ravens -

 

If you put:

 

SuperSecretPrivateSpecialStuff=True 

 

 

 

Works like a champ and is fairly straightfoward! 🙂

 

This method was posted in the forums at JKI.

Message Edited by Nickerbocker on 01-29-2010 04:07 PM

In what version of LabVIEW have you gotten this to work?

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 10 of 18
(3,158 Views)