pawhan11 Posted February 23, 2015 Report Share Posted February 23, 2015 Hello, Is there a way to set property node of another object by scripting ? As far as I looked I can only set property by ID string. Quote Link to comment
ak_nz Posted February 23, 2015 Report Share Posted February 23, 2015 (edited) 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 February 23, 2015 by ak_nz Quote Link to comment
pawhan11 Posted February 23, 2015 Author Report Share Posted February 23, 2015 So how can I create that?: Quote Link to comment
ak_nz Posted February 23, 2015 Report Share Posted February 23, 2015 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. Quote Link to comment
ak_nz Posted February 23, 2015 Report Share Posted February 23, 2015 (edited) 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. Edited February 23, 2015 by ak_nz Quote Link to comment
pawhan11 Posted February 23, 2015 Author Report Share Posted February 23, 2015 Thanks for help. I have done that arleady. When selecting property node we follow this path: and I want to do the same, select the same property as above via scripting but it seems that I cant. Quote Link to comment
hooovahh Posted February 23, 2015 Report Share Posted February 23, 2015 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. Quote Link to comment
hooovahh Posted February 23, 2015 Report Share Posted February 23, 2015 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 Quote Link to comment
pawhan11 Posted February 23, 2015 Author Report Share Posted February 23, 2015 Yes, that is exactly my point. I have done it by creating 2 property nodes but i want one. When we launch class browser it is possible to select that in the way I want... Quote Link to comment
hooovahh Posted February 23, 2015 Report Share Posted February 23, 2015 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. Quote Link to comment
Darren Posted February 23, 2015 Report Share Posted February 23, 2015 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! 1 Quote Link to comment
pawhan11 Posted February 24, 2015 Author Report Share Posted February 24, 2015 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... 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 ... Quote Link to comment
Phillip Brooks Posted February 24, 2015 Report Share Posted February 24, 2015 Another thing that I have been looking for, is there a way to acces context help data from within labview?? Been there, done that... https://lavag.org/topic/7328-programatic-control-of-the-context-help-window/ https://lavag.org/topic/9167-context-help-for-a-vi-without-loading/ Quote Link to comment
hooovahh Posted February 24, 2015 Report Share Posted February 24, 2015 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. Quote Link to comment
MikaelH Posted March 3, 2015 Report Share Posted March 3, 2015 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? Quote Link to comment
Yair Posted March 3, 2015 Report Share Posted March 3, 2015 (edited) 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: Edited March 3, 2015 by Yair 2 Quote Link to comment
MikaelH Posted March 4, 2015 Report Share Posted March 4, 2015 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: Example_VI.png Great, I might dare to try this. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.