LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

> Related links

Visit our LabVIEW Wiki Code Distribution Portal


Tags
2 Pages V   1 2 >  
Reply to this topic Start new topic
> Associating my EXE with a specific file extension type, Not working for me.
Rating 5 V
Michael_Aivaliot...
post Feb 24 2007, 11:26 AM
Post #1


Confucius say: Crowded elevator always smell different to midget
Group Icon
*****

Admin
Posts: 2363
Joined: 13-October 02
From: Planet Earth
Member No.: 2
Using LabVIEW Since:1994
LV:8.5 ,8.2.1 ,7.1.1
Greece Canada United States My Blog My Gallery


I was reading through a very thorough document here: File Handling Guidelines.
However it does not work for me. I keep getting the following dialog when I double-click a file:
Attached Image

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

--------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ad
post Feb 24 2007, 11:26 AM
Post #















Tags
(This content has not been tagged yet)
Go to the top of the page
Quote Post
Tomi Maila
post Feb 24 2007, 06:37 PM
Post #2


Drawing Tool - LVOOP example application
*****

Premium Member
Posts: 1168
Joined: 29-January 06
From: Helsinki
Member No.: 4014
Using LabVIEW Since:2004
LV:8.5.1 ,8.2.1 ,7.1.1
Finland Nothing Selected Nothing Selected My Blog


Are you able to execute

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

--------------------
Tomi Maila



Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Jim Kring
post Feb 24 2007, 07:51 PM
Post #3


Changing the world, one VI at a time.
*****

JKI
Posts: 1692
Joined: 22-October 02
From: San Francisco, CA
Member No.: 17
Using LabVIEW Since:1995
LV:8.2.1 ,8.5 ,7.1.1
United States us_california Nothing Selected My Blog My Gallery


QUOTE (Michael_Aivaliotis @ Feb 24 2007, 03:26 AM) *
I was reading through a very thorough document here: 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 tongue.gif

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

--------------------
-----------------------------------------------------------------------------------------------------
| Book | OpenG | LAVA | Champion | VIPM | Builder | Blog | JKI |
-----------------------------------------------------------------------------------------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Michael_Aivaliot...
post Feb 24 2007, 08:20 PM
Post #4


Confucius say: Crowded elevator always smell different to midget
Group Icon
*****

Admin
Posts: 2363
Joined: 13-October 02
From: Planet Earth
Member No.: 2
Using LabVIEW Since:1994
LV:8.5 ,8.2.1 ,7.1.1
Greece Canada United States My Blog My Gallery


QUOTE (Tomi Maila @ Feb 24 2007, 10:37 AM) *
"C:\Program Files\National Instruments\LabVIEW 8.2\labview.exe" "c:\path\to\myfile.lava"

Attached Image


QUOTE (Jim Kring @ Feb 24 2007, 11:51 AM) *
some examples of your key/values would help. I'll bet you're just missing some quotes around your paths.

Attached Image Attached Image

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

--------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Jim Kring
post Feb 24 2007, 09:07 PM
Post #5


Changing the world, one VI at a time.
*****

JKI
Posts: 1692
Joined: 22-October 02
From: San Francisco, CA
Member No.: 17
Using LabVIEW Since:1995
LV:8.2.1 ,8.5 ,7.1.1
United States us_california Nothing Selected My Blog My Gallery


QUOTE (Michael_Aivaliotis @ Feb 24 2007, 12:20 PM) *
...and before you jump on it, I tried putting the "c:hello.exe" in quotes as well but it didn't help.


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")
Application:Command Line Arguments Property
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 VI launched 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 stand-alone application, 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 Advanced page of the Application Properties dialog box. Example

--------------------
-----------------------------------------------------------------------------------------------------
| Book | OpenG | LAVA | Champion | VIPM | Builder | Blog | JKI |
-----------------------------------------------------------------------------------------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Michael_Aivaliot...
post Feb 24 2007, 09:27 PM
Post #6


Confucius say: Crowded elevator always smell different to midget
Group Icon
*****

Admin
Posts: 2363
Joined: 13-October 02
From: Planet Earth
Member No.: 2
Using LabVIEW Since:1994
LV:8.5 ,8.2.1 ,7.1.1
Greece Canada United States My Blog My Gallery


Ok, thanks Jim thumbup1.gif . 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.gif My problem was I did not have (--) and I did not even have the Builder flag set either. Both wrong.

--------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ton
post Mar 3 2007, 11:46 AM
Post #7


CCT It
*****

Premium Member
Posts: 1331
Joined: 13-June 05
From: Woerden, Netherlands
Member No.: 2399
Using LabVIEW Since:2001
LV:8.5.1 ,6.1 ,8.2.1
Netherlands hol_utrecht Nothing Selected My Blog My Gallery


I recently stumbled upon an application event that looks like this:
Application.OS Open Document, it is called when LabVIEW tries to open a non-LV document,
Attached Image
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
Attached File  FileLoader.zip ( 41.2K ) Number of downloads: 121

--------------------
Certified LabVIEW Developer
Shouldn't you be programming a Code Repository solution?


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Jim Kring
post Mar 3 2007, 06:23 PM
Post #8


Changing the world, one VI at a time.
*****

JKI
Posts: 1692
Joined: 22-October 02
From: San Francisco, CA
Member No.: 17
Using LabVIEW Since:1995
LV:8.2.1 ,8.5 ,7.1.1
United States us_california Nothing Selected My Blog My Gallery


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 LabVIEW 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.gif , 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 1] Yes, it works when the app is already running. Very cool! thumbup1.gif

[UPDATE 2] 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.

[UPDATE 3] I figured out how to get everything to work. Use the following registry settings: (The double hypen "--" makes the file path a "user argument" and thus suppresses the error message. Setting the ddeexec = open(%1) makes the DDE work right.)

CODE
REGEDIT
  
  HKEY_CLASSES_ROOT\.TON = tonfile
  
  HKEY_CLASSES_ROOT\tonfile = My Ton Files
  
  HKEY_CLASSES_ROOT\tonfile\shell\open\command = "d:\tonfile\application.exe" -- "%1"
  
  KEY_CLASSES_ROOT\tonfile\shell\open\ddeexec = open(%1)
  
  KEY_CLASSES_ROOT\tonfile\shell\open\ddeexec\Application = application
  
  KEY_CLASSES_ROOT\tonfile\shell\open\ddeexec\Topic = System

Attached File(s)
Attached File  FileLoader__JK01.zip ( 41.22K ) Number of downloads: 109
 

--------------------
-----------------------------------------------------------------------------------------------------
| Book | OpenG | LAVA | Champion | VIPM | Builder | Blog | JKI |
-----------------------------------------------------------------------------------------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ton
post Mar 3 2007, 06:55 PM
Post #9


CCT It
*****

Premium Member
Posts: 1331
Joined: 13-June 05
From: Woerden, Netherlands
Member No.: 2399
Using LabVIEW Since:2001
LV:8.5.1 ,6.1 ,8.2.1
Netherlands hol_utrecht Nothing Selected My Blog My Gallery


EDIT: see next post

This post has been edited by tcplomp: Mar 3 2007, 07:43 PM

--------------------
Certified LabVIEW Developer
Shouldn't you be programming a Code Repository solution?


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Jim Kring
post Mar 3 2007, 07:00 PM
Post #10


Changing the world, one VI at a time.
*****

JKI
Posts: 1692
Joined: 22-October 02
From: San Francisco, CA
Member No.: 17
Using LabVIEW Since:1995
LV:8.2.1 ,8.5 ,7.1.1
United States us_california Nothing Selected My Blog My Gallery


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.gif

Ton


See my 3rd update to my previous posting for a fully working solution thumbup1.gif

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. And, this feature first appeared in LabVIEW 8.2.

--------------------
-----------------------------------------------------------------------------------------------------
| Book | OpenG | LAVA | Champion | VIPM | Builder | Blog | JKI |
-----------------------------------------------------------------------------------------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ton
post Mar 3 2007, 07:26 PM
Post #11


CCT It
*****

Premium Member
Posts: 1331
Joined: 13-June 05
From: Woerden, Netherlands
Member No.: 2399
Using LabVIEW Since:2001
LV:8.5.1 ,6.1 ,8.2.1
Netherlands hol_utrecht Nothing Selected My Blog My Gallery


QUOTE (Jim Kring @ Mar 3 2007, 08:00 PM) *
See my 3rd update to my previous posting for a fully working solution thumbup1.gif

Allright, who is gonna buy who a beer question.gif

I figured a little more out, setting the registry with this options:
CODE
HKEY_CLASSES_ROOT\tonfile\shell\open\command = "d:\tonfile\application.exe"
    
HKEY_CLASSES_ROOT\tonfile\shell\open\ddeexec = open(%1)

You don't need the command line arguments, windows will launch the program via command, and will set up a DDE connection with (open(%1)), and the event is triggered!
Notice that the open\command does not include %1!
The whole code is:
Attached Image
Ton

This post has been edited by tcplomp: Mar 3 2007, 07:27 PM

--------------------
Certified LabVIEW Developer
Shouldn't you be programming a Code Repository solution?


Tags
(This content has not been tagged yet)