LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Scripting - Preserve a VI's namespace?

Hi,

 

I'm currently using VI Scripting to generate a set of VIs based on the contents of an xml file.  The set of generted VIs end up being claimed as part of a library file (call it library1.lvlib).  The problem is that if I need to regenerate these VIs I cannot seem to preserve the namesapce.

 

As an example, once claimed by the library, the VI will have a namesapce of library1.lvlib:MyGeneratedVI.  If I simply generte the VI then the namespace becomes MyGeneratedVI.  I tried modifying the Name property of the VI reference that I am saving but I keep getting an error 1 fromt he property node.  Documentation indicates that one can only write to the Name property if the file does not exist on disk.  I'm even adding a delete to adhere to this rule, but still get an error 1.

 

If I set some bogus namespace after deleting (say HelloWorld), then set of the Name property is successfull, but I don't see it reflected in the saved VI.  However trying to set something meaningful like library1.lvlib:MyGeneratedVI doesn't work.

 

Is what I am trying to do even possible?  Since the VI gets recompiled after it gets claimed by a library, I'm not sure if this is something that one can do through VI scripting.

 

0 Kudos
Message 1 of 4
(2,237 Views)

When in doubt, attempt to script the actions that one would manually do in the IDE.

 

I couldn't succesfully change the fully qualified name of the VI I was going to save.  Instead I'm finding the library that owns the original VI (if one exists), opening the library via the application class, programatically removing the unclaimed VI, and inserting it back again to fix the reprocity.  After performing these steps, a save operation is done to both the libray file, and VI (that was added to the library).

 

This should associate the auto generated VI with the library of the VI it replaced.

 

 

0 Kudos
Message 2 of 4
(2,219 Views)

I guess it's time to close one of these accounts :). (meks or mulac)

0 Kudos
Message 3 of 4
(2,215 Views)

Hi meks,

 

You may want to post this to the API Community: LabVIEW Scripting Main Board. You are more likely to get the best help there. 

0 Kudos
Message 4 of 4
(2,184 Views)