LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save a VI in another name programatically?

I tried this way, but it did not ot work... Smiley Sad

 

What could be the reason? Smiley Indifferent

 

Please see the attached screenshot.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 1 of 10
(3,701 Views)
Perhaps the VI is running? The method will fail if the VI is not idle.

Regards,

Wiebe.


0 Kudos
Message 2 of 10
(3,695 Views)

I actually read an LLB & list down all the VIs present in it using the List Folder file primitive.

 

Now I pass this Files array containing all the VIs' names inside a for loop & concatenate (prepend) it with my DUT name & build each new VI's path by stripping upto the folder containing the LLB & save all of them there.

 

I thought LV will do this in no time by creating one more copy of all the VIs inside the LLB & put them inside the same folder, but to my surprise, it is not happening like that...

 

What could be the reason?

 

I m sure that none of the VIs inside the LLB is running, so also the LLB itself.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 3 of 10
(3,690 Views)
Does the method return an error?

Regards,

Wiebe.


0 Kudos
Message 4 of 10
(3,686 Views)

Hi Parthabe,

 

Are you trying to save the VI that is running (ie: the one with the save as code) as another vi?  That won't work, because it has to be idle.

If you are trying to save another vi by running this vi, then you are missing some code, such as the reference to the other vi.

 

R

Message 5 of 10
(3,674 Views)

I was doing a mistake by stripping the LLB from the base path. Actually since I m trying to save all my VIs inside the LLB one more copy, I should not strip the LLB name while I pass it to the Open VI rreference node.

 

So, after rectifying this, everything works fine... Smiley Happy

 

Ray, special thanks to you for giving me the correct hint in your second pointer.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 6 of 10
(3,671 Views)

Note:

 

To avoid cross linking all of the VI and ctl files should be saved from the bottom up where "botton up" means you save the VI at the bottom of the hiarchy fist then work your way up. By saving the lower VI's first, their callers will know about the new location and names of the sub-VI when they are called.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 10
(3,655 Views)

Sorry Ben!

 

I m really NOT able to get your point... Smiley Sad

 

Can you explain me in further detail?

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 8 of 10
(3,646 Views)

Basically what I have developed so far is to read the VIs present in an LLB & prepend the DUT name to each of them & save as one more copy inside the folder parallel to the LLB location. Some of the VIs in the LLB call some other VIs from different LLBs residing in different locations.

 

So, when I use the Open VI Reference primitive, it pops up the Search & Load VI dialog, for each VI copied using the Save Instrument method.

 

I simply wait & watch till it finally finishes the copying of the VIs inside the LLB I specified. I do not use the Close VI Reference primitive inside the For loop, since that closes & opens each time in search of those VIs from those LLBs, resulting in enormous time consumption for the entire copying & Save As operation of my required LLB.

 

I also do not pass the Error Out from the Save VI method in a SR; I just pass it to an Error indicator kept inside the loop itself, just to avoid the popping out of the error dialog.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 9 of 10
(3,642 Views)

parthabe wrote:

Sorry Ben!

 

I m really NOT able to get your point... Smiley Sad

 

Can you explain me in further detail?


Say you have this hiarchy

 

 

If you save "A" first it will be saved such that it knows about where "B" is when "A" was saved. If you then go and save "B" to a new location, then "A" will have to be re-saved so it know about "B"s new name location.

 

Instead do the saves starting at the bottom.

 

Save "D" so all of its callers knows about the new name location of "D" then save "C" so it points at the new "D" and then work your way up the hiarchy.

 

Ben

Message Edited by Ben on 02-11-2009 08:49 AM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 10 of 10
(3,636 Views)