Jump to content

Recommended Posts

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

Link to comment

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.

Link to comment

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):

http://forums.lavag.org/index.php?act=attach&type=post&id=6380

This is also platform independent.

Link to comment

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.