LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

> Related links

Visit our LabVIEW Wiki Code Distribution Portal


Tags
(This content has not been tagged yet)
 
Reply to this topic Start new topic
> VI .exe Flag, Is there a flag indicating .exe?
h1voltage
post Jul 16 2007, 08:21 PM
Post #1


Active
*

Member
Posts: 21
Joined: 17-April 06
Member No.: 4775
Using LabVIEW Since:2005
LV:8.2.1 ,8.0.1 ,7.1
United States Nothing Selected Nothing Selected


Hello Everyone,
Is there a flag indicating whether or not a VI is actually a VI (.vi) or in executable form (.exe)? I need this so that I can conditionally find the relative path. Using the "Current VI's Path", you get the exe's path with the actual VI name appended to it (i.e. - C:\Projects\My Application.exe\Application.vi)

Any thoughts?
~Zack


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ad
post Jul 16 2007, 08:21 PM
Post #















Tags
(This content has not been tagged yet)
Go to the top of the page
Quote Post
Yair
post Jul 16 2007, 08:23 PM
Post #2


Extwemely Active
*****

Premium Member
Posts: 1621
Joined: 23-January 05
From: Here
Member No.: 1431
Using LabVIEW Since:2003
LV:8.6 ,7.0 ,.
Israel Nothing Selected Nothing Selected


The Application class has a property called Kind which will return an enum telling you whether you're running inside LabVIEW or in a built executable. You can get it simply by dropping a property node on the diagram.

--------------------
More than meets the eye...


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
ooth
post Jul 17 2007, 05:01 AM
Post #3


More Active
**

Member
Posts: 32
Joined: 19-October 04
Member No.: 858
Using LabVIEW Since:2000
LV:8.5 ,6.1 ,.
United States Nothing Selected Nothing Selected


Here are some VIs that I use. I cannot find where I got them and I'm sorry to the author for not siting his/her work.
The CallerIsExe.vi is the one that will help you. Just drop it in a VI and wire the Current VI's Path constant into it.
Attached File(s)
Attached File  BasePath.vi ( 10.6K ) Number of downloads: 133
Attached File  CallerIsExe.vi ( 8.28K ) Number of downloads: 151
 


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Yair
post Jul 17 2007, 05:02 PM
Post #4


Extwemely Active
*****

Premium Member
Posts: 1621
Joined: 23-January 05
From: Here
Member No.: 1431
Using LabVIEW Since:2003
LV:8.6 ,7.0 ,.
Israel Nothing Selected Nothing Selected


Relying on the exe extension is problematic. You might have a file which is not an executable file but has an exe extension or you might have a directory which has an .exe at the end of its name or you might be running on Linux or Mac, where you don't have the extension.

A better way would simply be to use the property I mentioned and then output T or F based on its value.

Another option for simplifying the subVI as it is now is to to use the Call Chain primitive and index out the second element, which would be the calling VI. You can then open a reference to it and get its path using a property node instead of having to wire its path into the subVI, but I would advise the first method.

As for the base path VI, it suffers from the same basic problem. I prefer the OpenG method, which is basically getting the path of the VI (using the method I mentioned) and then stripping in a loop until the File/Directory Info primitive returns T in its directory output, like this quick example (which does not do error handling):
Attached Image

This is also platform independent.

--------------------
More than meets the eye...


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Jon Sweeney
post Jul 17 2007, 05:13 PM
Post #5


More Active
**

Member
Posts: 30
Joined: 3-July 03
From: Long Island, NY
Member No.: 133
Using LabVIEW Since:1993
LV:8.20 ,. ,.
United States us_new_york Nothing Selected


QUOTE (ooth @ Jul 16 2007, 11:01 PM) *
Here are some VIs that I use. I cannot find where I got them and I'm sorry to the author for not siting his/her work.


The author's name is included in the context help documentation.

--------------------
Jon Sweeney


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
ooth
post Jul 17 2007, 06:14 PM
Post #6


More Active
**

Member
Posts: 32
Joined: 19-October 04
Member No.: 858
Using LabVIEW Since:2000
LV:8.5 ,6.1 ,.
United States Nothing Selected Nothing Selected


Yen, Those are very good points. I'll start using the Kind property now.


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

 




Time is now: 22nd November 2008 - 02:26 AM