Jump to content

Scripting Property node


pawhan11

Recommended Posts

Yes, it is entirely possible if you have a reference to the object.

 

Make sure you have VI Scripting enabled in your LabVIEW options (under the VI Server section) in order to see more useful methods and properties of VI Server objects.

Edited by ak_nz
Link to comment

My mistake, I assumed you meant replacing the control applied to rather than the destination of the node. Are you sure that Property is the write type? I assumed this was for any Property Node call, rather than the specific PropertyItem GObject.

Link to comment

Here's a simple example that replaces all property nodes that exist for a given control ref with a different type. In my case I have specified a Numeric type; feel free to change this to suit. Note that the VI with the property nodes must be in edit mode for this to work; as a result it might not suit your use case.

post-27534-0-41219800-1424721684_thumb.p

Edited by ak_nz
Link to comment

You can, you just need to know what the unique string is.  In this case on LabVIEW 2013 SP1 it is 632d809.  The way I found this is by getting the property node reference, then using the Invoke node Get Prop Item, with index 0.  This gets the reference to the first property item on a property node.  Then using a property node I read the "Property" cluster which returns the current selected property item of that property.

 

EDIT: Maybe I need to look into this more it didn't work as expected.

Double Edit:  So it looks like I can use the property node to get a reference to the Label, but not to a property of that label.

Link to comment

Okay so attached is some code that probably puts into words what I can't.  Unzip and run Get Properties.  It would try to get the property of a property node which is in a second VI.  This property is the FontBold, but this is not referencing the control, it is now referencing the label of the control.  So we return the Unique ID String but this unique string is not a valid one for the current property node, which happens to be for a control reference, not a label reference.  I think what you want to do can be done with scripting by adding two property nodes, one for getting the label and one for setting the font bold.  I hope this is an oversight on my part and there is a way to do this in one property node but I can't figure out how using scripting.

Property Selection Issue.zip

Link to comment

Okay this solution would work but sucks if there are no other suggestions.  You can make a sub VI with just the property node you want in it.  Then using scripting you can copy that function and paste it where you want, then wire it up.  I'm really hoping this isn't the only solution by the way.  I'm sure someone at LabVIEW R&D could answer if it is possible to do this with scripting.

Link to comment

I am not aware of a way to script a dotted property. It's been one of my top requests for scripting for years now, because of how frequently I use the Ctrl-Shift-B shortcut in Quick Drop to rename a property/invoke node...I can't set "Label.Text", and it drives me crazy!

  • Like 1
Link to comment

Good to know. I wanted to create addon that allows inserting properties like in text languages but it seems that i ve hit the wall here...  :frusty:

Another thing that I have been looking for, is there a way to acces context help data from within labview?? I have done that by exploding chm file and rendering html in browser activex but that is very slow ...

Link to comment

I am not aware of a way to script a dotted property.

Thanks Darren for closing the loop on this.  Without someone from NI saying "This can't be done as far as I know" we all just spin our wheels and think maybe we missed something and the feature is there buried somewhere, like with a dot notation.

Link to comment

I have another scripting task I like to do.

I like to create a static Property node linked to the Pane, not a control.

The Invoke method to link a Front Panel item to the property node, only accepts a Control, and can't take a Pane-reference.

Is there another way?

post-941-0-87186100-1425363139.png

 

Link to comment

The method appears to accept any valid object reference, so when I typecast the pane ref to a control ref, it appears to work. This, of course, comes with the usual warnings about typecasting references:

 

post-1431-0-15818000-1425380132.png

Edited by Yair
  • Like 2
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.