Jump to content

VI's that are 'self aware' of the package name and version


Recommended Posts

Hi,

 

So I have a large number of code modules or packages that we leverage to manage code re-use. We use the VIPM 'Display Information' with 'Edit All VI Descriptions' checked and we add the following to all VI descriptions:


-----------
{product_name} <b>{version_number}</b>
{author_name} - {company_name}
{copyright}
Now, as a legacy, several of our modules would have a VI-constant containing nothing but a string constant and a string indicator wired to the constant. The constant would have our product name and/or version#. The problem is that this is all manually maintained, which is less than ideal.
So, we wrote a new 'brat' (VI that acts on or affects the calling parent(s) without any inputs) that would get the calling parent's VI description and using a couple of simple reg-ex's it would parse out the {product_name} and the {version_number} and return it to the caller. Presto, now our code could self-report their current package name and version!
The problem we have is that this does not work for RT targets (error 56, Manager call not supported).
What to do now? -We could do a VIPM 'pre/post build actions' and before the package is built, run a VI that prompts for the location of the 'version constant' VI and opens/edits the constant value, but I don't know how/if my pre-build action VI would be able to automatically get package name and version from VIPM. We probably could run a post build action, and get it from the VI description using a modification of our existing brat, but I'm not sure again how editing post build VI's would work out.. Is the post build VI run before the VI's are sucked into the 'zip' package? where are the VI's temporarily stored?
My goal would be to not have any manual input at all to this step, for example by standardizing on the file-name of the 'constant version string.vi' and using scripting to edit the BD constant prior to build completing.
I'm wondering if anyone has done something similar already and/or could help me get started in the right direction.
Thanks!
PS where are the moderators? why are there 'topics' about viagra on your forum's that are not deleted?)
Link to comment
Share on other sites

So a near ideal fix was to create a pre-build custom action VI using VIPM.

This VI searches the list of source-files looking for VI "files named anything at all Version String more anything.VI" using this regex expression.

.*?(?=[Vv]ersion [Ss]tring).+?(?=(\.[Vv][Ii])$)

If found, Open VI Reference is used along with 'method: Control Value.Set' and 'method: Default Values.Make Current Default' followed by 'method: Save.Instrument' (then close reference).

 

There is a one-time setup required to create (or rename) the string indicator(s) with appropriate name(s), but afterwards, this does the trick for me. I could extend it as needed, including (with a lot more work) to automatically create (from template) a Version String VI if it is missing, and then (somehow?) add it to the template prior to the build..

 

I attached a simple example saved in LV2012.

 

Hope this helps someone, and if you extend it to create the file (if missing) I would appreciate it if you shared the improved version back to the forum. :)

Pre-Build Custom Actions (LV2012).vi

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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