Jump to content
John Lokanis

Need some Scripting Ninja help - Finding Constants

Recommended Posts

I need some help from a scripting ninja.  I need to find all instances of a particular sub-vi in every VI in a project and then find out the value of the constants that are wired to this VI as inputs.

 

Specifically, I am looking for every place the "Error Cluster From Error Code.vi" is used in a project.  I then want to get the value of the constant that is wired to the 'error code' input.  Next I want to get the value of the constant wired to the 'error message' input.  If the 'error message' input is connected to a 'format into string' function, then I want to traverse to that node and grab the constant wired to the 'format string' input.

I want to output an array with each row having the name of the vi that contains a "Error Cluster From Error Code.vi" instance, the value of the 'error code' constant and the value of the 'error message' or 'format string' constant.

 

So far I have gotten an array of the VIs that use the "Error Cluster From Error Code.vi" and have been able to pull the reference to the "Error Cluster From Error Code.vi" sub-vi on each instances BD but I am unsure of how to find the constants attached and pull their values.

 

I would appreciate any help, even in the form of a list of steps to follow so I can code up a solution.

 

thanks!

 

-John

Share this post


Link to post
Share on other sites

Heres a good start.  I don't really have the time to do all of it.  Provide a path to the Main VI, then run this.  I will find all callers of that function, then in each VI look at each subVI.  If the subVI called is the error one, then it opens a reference to the terminal, gets the source of the wire, opens a reference to a constant wired to it, then gets its value.  I think I forgot to close all opened references, and this has an output letting you know if something other than a constant (or nothing) was wired to the error code (0) input.

Find All Error Code (0) Constants.vi

Share this post


Link to post
Share on other sites

That seems like a great util to start a code clean-up with. I've done this so many times manually to replace those vis with my own SetError.vi that takes an error type-def instead of the numeric.

Would you share it around when you've got it working?

Productivity++

 

Edit: Also, it would be nice to be able to reduce the list of inspected files a root folder + subfolders (so we can ignore stuff that comes out of external libraries or the LabVIEW folder)

Edited by ThomasGutzler

Share this post


Link to post
Share on other sites

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.