Jump to content

Scripting of Custom Typedefs


bariman8

Recommended Posts

Hi Everyone,

:question:

I've got another question.  Is it possible to create a typedef or strict typedef using the New VI object and New VI function.  I've been able to create a control vi but I haven't been able to change it to a typedef or strict typedef control. 

Thanks for the help,

Derek Lewis

1557[/snapback]

Hmmm, it might be possible, but what I think you want to do is create a CTL file (which is a VI of type custom control) and then set it to be a strict typedef. Then drop this item using the New VI Object function, using the typedef CTL file's path as the source of the new object.

Link to comment

Jim,

I think I understand what you're saying however the problem that I'm running across is that basically I want to create a control once using it as a template to save typedefs off of. From there I then can iterate creating and saving new typedefs off of that one template control but changing labels and stuff like that. After that is complete, I made a VI that can make an old style global vi using each of those typedefs as the input and output.

I hope that made sense :)

Derek Lewis

Link to comment
  • 2 weeks later...
Jim,

I think I understand what you're saying however the problem that I'm running across is that basically I want to create a control once using it as a template to save typedefs off of.  From there I then can iterate creating and saving new typedefs off of that one template control but changing labels and stuff like that.  After that is complete, I made a VI that can make an old style global vi using each of those typedefs as the input and output.

I hope that made sense  :)

Derek Lewis

1559[/snapback]

I suggest that you work on an example, and let others help you along.

Link to comment

Jim,

Thanks for the help. I figured out the problem that I was having. I did not know that there was a property node for VI:Control VI Type. :oops:

Once I found that property I could change the control type to a strict typedef. I finished a VI that iterates through a directory and creates the USR (uninitialized shift registers) style globals automatically based on the controls found in that directory. If you're interested I can upload it here. Thanks for the help.

Derek Lewis

Wineman Technology

Link to comment
  • 3 months later...
Jim,

Thanks for the help.  I figured out the problem that I was having.  I did not know that there was a property node for VI:Control VI Type.  :oops:   

Once I found that property I could change the control type to a strict typedef.  I finished a VI that iterates through a directory and creates the USR (uninitialized shift registers) style globals automatically based on the controls found in that directory.  If you're interested I can upload it here.  Thanks for the help.

Derek Lewis

Wineman Technology

1657[/snapback]

Great VI that you created. :worship:

Yes, please upload. This would be very useful as a building block for creating other controls. I have a specific application that I could use this on right now and would be happy to post my mods at project end.

Link to comment
  • 2 weeks later...

Hello all,

Sorry for responding to this post so late. Been a busy end of the year. I've attached the old global generation VI to this post. Some things to note : Be sure to point the path to the old global template.vi wherever it resides on your pc. The code is quite messy as it was one of my first forays into scripting and I coded it pretty fast and not well documented :) . Also there is a bug that I never could figure out where occasionally a new control would be created outside the loop and that messed everything up. This is why the loop size is so large to increase the chances that wouldn't happen.

Enjoy and feel free to ask questions if I can remember how all of it works :thumbup:

Derek Lewis

Download File:post-620-1104841137.zip

Link to comment

Very nice!! Thank you for contributing this Derek! Another good example of scripting.

You also mentioned that you had been able to create a control VI and controls now. Any chance that you could upload an example of that? It would really help out with another utility I am working (actually trying to find time to work on...) on that makes DLL wrapper VIs. The code example you gave above is already helping with that.

Link to comment
Very nice!! Thank you for contributing this Derek! Another good example of scripting.

You also mentioned that you had been able to create a control VI and controls now. Any chance that you could upload an example of that?  It would really help out with another utility I am working (actually trying to find time to work on...) on that makes DLL wrapper VIs. The code example you gave above is already helping with that.

3375[/snapback]

Mike,

The code that's in there can do some very primitive control generation. The problem is if you want a complex control, i.e. a cluster of different types, this becomes a hassle.

If you look at the Generate New Global VI.vi block diagram towards the left of that VI you'll see a new labview primitive named "New VI Object". The control type input on that indicates what type of control you want to create; string, numeric, etc. It uses that as an input UNLESS you have a typedef path input connected.

Therefore for my global generation code to work it actually iterates on a directory of typedefs and creates a control based on that typedef in the VI template for an old global. After hooking up wires to the shift registers it then calls an invoke node for Create indicator just as you would in labview. After all of that is complete it hooks up the control and indicator to the connector pane.

I hope that helps to explain how it all goes together.

Cheers, :beer:

Derek Lewis

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.