I couldn’t live without relative path inputs to file constants

Posted on Friday 18 May 2007

This is the ninth article of “The OpenG VIs that I couldn’t live without“, a series of articles showing some of my favorite OpenG VIs. In this article, I’m going to show you a great hidden feature of the OpenG File Tools library: relative path inputs to file constants. You might have noticed that all of the file constants on OpenG File Tools File Constants subpalette have a “Relative Path (.)” input, and you might also be wondering what the heck this is for. For example, here are the NI and OpenG versions of the Temporary Directory function.

NI Version…

Temporary Directory

OpenG Version…

Temporary Directory (OpenG)

The “Relative path (.)” input of the OpenG version allows you to avoid some of the extra code required to build a path, relative to the constant (and, if you leave that input unwired, then the function simply outputs the path, in the same way as the NI function). For example, let’s look at a common use case, implemented with the NI version of Temporary Directory.

Example (NI)

Now, let’s look at the equivalent code, using the OpenG version.

Example (OpenG)

That’s one less node and one less wire. It’s not much, but it adds up!

If you want to give these OpenG file constant VIs a try, you can obtain them using VI Package Manager (VIPM). Simply select the OpenG File Library (the oglib_file package from within VIPM), you will find the OpenG File Tools palette (and File Constants subpalette) in the Functions palette under the OpenG submenu. (See here for a quick guide on how to install OpenG on VIPM.)


No comments have been added to this post yet.

Leave a comment

(required)

(required)


Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.


RSS feed for comments on this post |

 

Bad Behavior has blocked 5047 access attempts in the last 7 days.