Jump to content
Michael Aivaliotis

Associating my EXE with a specific file extension type

Recommended Posts

Are you able to execute

"C:\Program Files\National Instruments\LabVIEW 8.2\labview.exe" "c:\path\to\myfile.lava"

Share this post


Link to post
Share on other sites

QUOTE(Michael_Aivaliotis @ Feb 24 2007, 03:26 AM)

I was reading through a very thorough document here: http://openg.org/tiki/tiki-index.php?page=File+Handling+Guidelines' target="_blank">File Handling Guidelines.

However it does not work for me. I keep getting the following dialog when I double-click a file:

I've built the app in LV8.0 and I'm using the exe launcher trick.

Post a copy of your windows registry so that it's easier to help you debug :P

But seriously, some examples of your key/values would help. I'll bet you're just missing some quotes around your paths.

Share this post


Link to post
Share on other sites

QUOTE(Tomi Maila @ Feb 24 2007, 10:37 AM)

post-2-1172348190.png?width=400

QUOTE(Jim Kring @ Feb 24 2007, 11:51 AM)

post-2-1172348403.png?width=400

post-2-1172348410.png?width=400

...and before you jump on it, I tried putting the "c:\hello.exe" in quotes as well but it didn't help.

Share this post


Link to post
Share on other sites

QUOTE(Michael_Aivaliotis @ Feb 24 2007, 12:20 PM)

Hmmm, my guess is that customfile.lava is not a valid LabVIEW file (that's what the error message says).

If you have a non-LabVIEW file that you want your exe stub to handle, you need to pass it as a user-defined command-line argument, according to LabVIEW conventions (pass it after the double hyphen "--").

QUOTE("LabVIEW Help")

Returns an array of user-defined command-line arguments passed when LabVIEW launched. User-defined arguments start after two hyphens (--) surrounded by spaces in the command line.

The first string in the array is the name of the executable launched. This property does not return the name of the
or the LLB that contains the VI. If a user-defined command-line argument contains double quotation marks ("), this property returns the argument without the quotation marks.

If you use this property in a
, you can pass all arguments as user-defined arguments so you do not need to enter the two hyphens before user-defined arguments in the command line.

This property is similar to the
Pass all command line arguments to application
option on the
page of the
dialog box.

  • Like 1

Share this post


Link to post
Share on other sites

Ok, thanks Jim :thumbup: . This all makes sense now. The original document I referenced is out of date at this point since several key elements are missing. I should of read the NI help. :book: My problem was I did not have (--) and I did not even have the Builder flag set either. Both wrong.

Share this post


Link to post
Share on other sites

I recently stumbled upon an application event that looks like this:

Application.OS Open Document, it is called when LV tries to open a non-LV document,

(link removed)

I've tested it, and it works!!!

One downside, the first call to the exe will result in an error of LabVIEW claiming it is a non-LV file, consequitive calls work great!

Included a project (with exe) that shows the work. You have to register the tonfile.reg file, copy the exe into c:\tonfile, the open one of the two *.ton files, the first will show an error unsure.gif , however clicking the file again will load the path into the VI

Ton

(link removed)

Edited by crelf
Irrepairable broken LAVA 1.0 links removed

Share this post


Link to post
Share on other sites

QUOTE(tcplomp @ Mar 3 2007, 03:46 AM)

I recently stumbled upon an application event that looks like this:

Application.OS Open Document, it is called when LV tries to open a non-LV document,

I've tested it, and it works!!!

One downside, the first call to the exe will result in an error of LabVIEW claiming it is a non-LV file, consequitive calls work great!

Included a project (with exe) that shows the work. You have to register the tonfile.reg file, copy the exe into c:\tonfile, the open one of the two *.ton files, the first will show an error :unsure: , however clicking the file again will load the path into the VI

Ton

Ton,

That's a great find! Does it work for files sent with DDE (after the App is already running)?

I wonder if there is any way to suppress the error message.

Thanks,

[uPDATE] Yes, it works when the app is already running. Very cool! :thumbup:

Share this post


Link to post
Share on other sites

QUOTE(Jim Kring @ Mar 3 2007, 07:23 PM)

I just figured out that the error message only appears when the application is passed the file path via the command-line argument (when app is first launched). The error does not occur when the files are sent via DDE. For example, if you launch the app manually and then double-click your files, there is no error message.

Yes it is the DDE implementation, the bad thing is launching the program via the file-ref is not working, and the way to get that working (pass command line parameters) will break this method :thumbdown:

Ton

Share this post


Link to post
Share on other sites

QUOTE(tcplomp @ Mar 3 2007, 10:55 AM)

Yes it is the DDE implementation, the bad thing is launching the program via the file-ref is not working, and the way to get that working (pass command line parameters) will break this method :thumbdown:

Ton

See my 3rd update to my previous posting for a fully working solution :thumbup:

Also, it's worth mentioning that this OS Open Document Application Event is exposed when you have the SuperSecretPrivateSpecialStuff=True setting in your LabVIEW.ini file.

Share this post


Link to post
Share on other sites

QUOTE(tcplomp @ Mar 3 2007, 11:26 AM)

Allright, who is gonna buy who a beer :question:

I figured a little more out, setting the registry with this options:

I think that Michael is going to need to buy us both beer :P

Great work, Ton! Now we just need some nice VIs for setting these actions in the Windows Registry (so that we don't need to run .reg scripts)...

Share this post


Link to post
Share on other sites

This is great! I already have a working solution and I am only using 8.0 but when I'm ready, I'll use it. Thanks.

I hope NI doesn't remove this feature just because we discovered it. :( . That would be mean.

Share this post


Link to post
Share on other sites

Hi, aren't you guys (I mean Michael and Jim) suppose to sit side by side in an office? Or you like to broadcast your office conversation? But I think we don't mind to hear :rolleyes: . Just curious :)

Irene

Share this post


Link to post
Share on other sites

QUOTE

Or you like to broadcast your office conversation?

I think they broadcast for the benefit of the community. If they hadn't broadcast this question, they wouldn't have come up with this answer.

Either way, thanks for this thread and its information. I'll be using this method in the near future with an 8.2 project. Guess I'll have to turn on the SuperPrivateSecret(Captain)Stuff to see this event.

Share this post


Link to post
Share on other sites

Ahh.... My pet problem with LabVIEW apps solved! I'll pay you beers guys.

I have a VI to register file extensions. I'll make it available when I'll have access to it.

Great find!

Share this post


Link to post
Share on other sites

I think they broadcast for the benefit of the community. ]

I said we don't mind to listen!! :unsure:

Share this post


Link to post
Share on other sites

QUOTE(Irene_he @ Mar 5 2007, 02:25 AM)

...we don't mind to listen!!

They're LAVA exhibitionists, and we're LAVA voyeurs... ;)

Share this post


Link to post
Share on other sites

QUOTE(Irene_he @ Mar 3 2007, 09:57 PM)

Hi, aren't you guys (I mean Michael and Jim) suppose to sit side by side in an office? Or you like to broadcast your office conversation? But I think we don't mind to listen :rolleyes: . Just curious :)

Irene,

Yes, Michael and I chat all the time. However, making conversations visible on LAVA means that others get to participate and contribute. In this case, Ton discovered a beautiful gem and shared it with us. Maybe that wouldn't have happened if we hadn't taken our discussion public. I think it benefits everyone to have an open discourse.

-Jim

Share this post


Link to post
Share on other sites

It is usefull to express your (inhouse) problems public, it'll trigger other people.

I have the feeling I get some sort of sixth sense for forums, sometimes I read about a bug and stumble upon it the next day (happened twice to me....)

I found the Application event friday, said i'd look into it into the weekend, and then remembered Michaels post (just a week old).

Now another Application event (VI activation) is kinda buggy... if someone finds a way to make that one usefull, PM me!

Ton

Share this post


Link to post
Share on other sites

QUOTE(jpdrolet @ Mar 4 2007, 10:08 AM)

Ahh.... My pet problem with LabVIEW apps solved! I'll pay you beers guys.

I have a VI to register file extensions. I'll make it available when I'll have access to it.

Great find!

OK I thought I'd have time to modify it to use Registry VIs but here it uses regedit.exe.

Share this post


Link to post
Share on other sites

Hi at all,

this looks very interesting but I tried to make this run under LV 8.5 and LV8.2.1 and it doesn't work. Even the "OS Open Document"-Event isn't available in these versions.

Have you made the same experiences?

Nicolas

Share this post


Link to post
Share on other sites

QUOTE(Jim Kring @ Mar 3 2007, 09:00 PM)

QUOTE(nicolasB @ Oct 9 2007, 01:48 PM)

this looks very interesting but I tried to make this run under
LV
8.5 and LV8.2.1 and it doesn't work. Even the "OS Open Document"-Event isn't available in these versions.

I haven't tested it in 8.2 but I wouldn't think it has changed. (you can see it probably in VIPM but Michael should know that)

Ton

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.