01-28-2010 09:32 PM
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
Solved! Go to Solution.
01-28-2010 09:55 PM
Ohhh....
SuperSecretPrivateSpecialStuff=True
Of course. 😛
01-28-2010 10:39 PM
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
01-28-2010 10:55 PM - edited 01-28-2010 10:56 PM
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.
01-28-2010 11:23 PM
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
01-28-2010 11:28 PM
Ravens Fan's method does works:
This can open a JPEG picture.
NOTE there must be a configuration in build specification
01-29-2010 12:16 AM
NIhuyu wrote:Ravens Fan's method does works:
Yes, but only for the first file (when the application is not open yet).
Ton
01-29-2010 04:59 PM - edited 01-29-2010 05:07 PM
@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.
01-29-2010 05:09 PM
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 ......
01-29-2010 05:24 PM
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