Code Challenge: (originally posted to IFLV)
PART 1:
But I think that it will soon be possible to do exactly what you say above, grab a VI's own icon, drag and drop, and (if you have a switch or two set and some LabVIEW scripting in place) have the VI replaced on the diagram with a subVI created from a template (like the Factorial VI) modified by LabVIEW scripting, with the name of the VI replaced, or Run Method calls, etc.
We just need to be able to capture the LabVIEW error/exception before the error dialog pops up and script away. Now that I think of it, I don't know of anything concrete, but I'd be pretty surprised if someone at NI doesn't either already have this or could code it up pretty quickly.
Sounds like it would make a good IFLV/OpenG/LAVA/NIDevZone coding challenge considering that the scripting interface has been unofficially exposed recently.
Any thoughts anyone? (or better yet, code)
PART2:
Just thought of a possible easier alternate method,
the:
"General Recursion Call (Variant).vi"
1. Use Call Chain or OpenG vi to get reference to calling VI.
2. Use LabVIEW scripting to get calling VIs connector pane.
3. Use Get Controls (Variant) from OpenG to read the indicator(s) of the calling VI.
4. Use Set Controls (Variant) from OpenG to write to the control(s) of the new instance of the calling VI.
5. Use Run Method with Wait for Completion = TRUE
6. Use Get Controls (Variant) to read the indicator(s) of the new instance VI.
7. Process and return...
Granted, it is not "grabbing own VI icon", but include in \user.lbi\... etc...
Did I forget anything? Now, who will come up with the most elegant :beer: :thumbup: implementation, or a proof :headbang: that this will not work?
As my college prof's all said,
"the rest is left as an excercise for the student..."
Ciao, Mike