07-16-2009 09:18 AM
Hi,
let's assume I have an llb containing several VIs. All VIs contain a control named "Control1". This control has a data range restriction in all VIs (lets say min value 1, max value 5, increment 1). Now I want to change the data range for this control in all VIs (let's say to min value 1, max value 1000, increment 1). Is there any way to do this automatically? Or do I have to open each single VI, right-click on the corresponding control, select "Data Range" and make my changes? I already have a main VI containing all VIs from the library (no real code, just a collection), so maybe there is an automatic way to handle these changes?
I am aware of the fact that using a custom control would have been the correct solution here. Anyway, this control was never meant to be changed, so there is no custom control now but a standard control with the same behavior in all VIs... I hope somebody has a suggestion as in fact there are many hundred VIs with this control to be changed...
Best regards,
Gabs
07-16-2009 09:23 AM - edited 07-16-2009 09:24 AM
Hi Gabs,
here are the steps to go:
-"list" all vis in the llb
-open a reference to each vi in a loop
-get all control references of the vi
-pick the correct one
-use property nodes for this control...
Don't forget to save the vis after changing the control properties...
07-16-2009 09:43 AM
Hi Gerd,
thanks for your answer, but that sounds like much more time-consuming work than the simple "open and do" procedure, isn't it?
Regards,
Gabs
07-16-2009 09:53 AM
that sounds like much more time-consuming work than the simple "open and do" procedure, isn't it?
Well, that depends on how many controls you're talking about.
All you've said is "several" . If you've got 5 or 10, sure, just do it. If you've got a hundred, then think about automating it.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-16-2009 09:54 AM - edited 07-16-2009 09:55 AM
Hi Gabs,
when you say "there are many hundred vis" then I would create a small vi, that does those steps in a loop...
It really helps when the control in question always has the same label.
07-16-2009 09:58 AM
It is one control in several hundred VIs, organized in about 10-15 llb's. The name of the control is always the same.
Maybe I didn't understand the automation method correctly. How could I "list" all VIs automatically? If I would have to type the VIs names into an array by hand that would cost too much time. But I would need such an array to be able to open the VI reference in a loop, right?
Regards,
Gabs
07-16-2009 10:05 AM
07-16-2009 10:09 AM
Ah - right! Sorry, I didn't think of that. I will try that out and will let you know if it worked as expected. Thank you all!
Best regards,
Gabs
07-16-2009 10:13 AM
Maybe I didn't understand the automation method correctly. How could I "list" all VIs automatically? If I would have to type the VIs names into an array by hand that would cost too much time.
You have a computer in front of you , use it.
Write a program to list all LLBs in a folder.
FOr each LLB
List all VIs in llb
For each VI
Ref = Open VI (path)
Changed = FALSE
Ctls = Get Front Panel Controls (ref) // I don't remember the exact name
For each control
If Ctl.Name = "Control1"
Ctl.Range.Maximum = 1000
Changed = TRUE
end if
end for
if Changed
Save VI (ref)
end if
Close Ref
end for
end for
Make sure you make a backup of the whole shebang before running!
Blog for (mostly LabVIEW) programmers: Tips And Tricks