02-12-2016 08:38 PM
I've been having fun scripting the Project browser. After duplicating a library and it's associated build specificatoins, I'd like ot reorder the view in hte project. I notice that the xml file has entries for the lvlib items. If I rearrange hte items manally the list in the XML becomes reordered. Is there a way to accomplish this programatically? I can get a list of the (references to) the lvlibs in the project, and I can order them, but how do I write this back to the project?
My first pass attempt was to get reference to each library, delete them, and then add the items back based on their original names and paths. this works, but it's slow.
Extending this to Build Specifications is more complicated, becasue these have a bunch of tags. So it's copy all the tags, delete the spec, create a new spec, and write all the tags into the new spec. It would probably work, but it's going to be slow.
Reason for doing this: using the project to manage a large nyumber of tests that are built from a template, programatically. As new tests are added, they should be sorted in the project.
02-12-2016 11:44 PM
What I would try to do:
With the project closed, have your utility VI open the .lvproj file as a text file. Use the string functions to manipulate the string data. Write it back out to the .lvproj.
(Experiment on backup copies of your project. My thought is this should work if you are careful, but if your code isn't quite right, you could screw up other sections of the .lvproj file and maybe it corrupts the overall project.)
02-16-2016 12:21 PM
Good idea. My "copy template" woorks within an open project. I guess I can close the project, manupulate the xml, and then reopen. I've heard of issues with trying to modify the raw xml of a project file, but I'll give it a shot and report back.