From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i get the true path of the dynamic VI after build application?

When I built application(APP.exe),  A.vi   was included as dynamic VI.    main.vi is the top-level VI of APP.exe.
 
In the diagram of main.vi, I used the "copy file" to copy A.vi.  The source path of "copy file" is   
 
Current VI's Path  +  Strip Path + Build Path (name string is "A.vi") ;And the target path of "copy file" is 
 
Current VI's Path  + Strip Path +Strip Path + Build Path(name string is "B.vi").
 
And then I use vi serves to make B.vi run. In development environment, it works ok.  
 
But after i built application,  I always get the "error 7, Copy in main.vi"  when I try to copy the  A.vi. Why?   
0 Kudos
Message 1 of 6
(2,610 Views)

You really shouldn't start a new thread for this. It would just cause some people to answer here and some there when there's no reason for it. Post any further replies in the other thread.

If you look at Help>>Explain Error, you will see that error 7 is "File not found". If you place indicators to see what the file paths are for the copy operation you should probably understand what the problem is. Again, why not use VI templates?


___________________
Try to take over the world!
Message 2 of 6
(2,607 Views)
I sorry for that.
 
I already completed  the program using the copy function. and it runs ok in development environment but not in application.
 
I will try to use template.  But now I had the problem of using dynamic VI in build application, it will be used even though I
change  to use template.
 
I don't understand why the file actual exist but the error 7 still appear?
 
I had placed  the indicator  after  Current VI's Path  +  Strip Path + Build Path (name string is "A.vi") , and is display "../APP.exe/A.vi".  I thinked the path is right, but why i still get the error 7. 
0 Kudos
Message 3 of 6
(2,602 Views)
I think that Copy File needs a "true" file as input. The dynamic vi is not a file from the point of view of the operating system.
Try opening a reference to your vi, wire the reference to an Invoke Node and use the VI Server method Save Instrument.
I've not tested this, but I think it should work.
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 4 of 6
(2,596 Views)


@pincpanter wrote:
I think that Copy File needs a "true" file as input. The dynamic vi is not a file from the point of view of the operating system.

That's a very good point and appears to be the right explanation. The proposed solution would not work, however, since the RTE does not have the ability to save VIs. What will needed to be done instead is make sure that the VI is not included in the build and placing it outside of the exe. That way, the OS will see it as a real file and will be able to copy it. Obviously, the better solution would simply be working with a VIT which will let LV handle the copying. All you need to do is dynamically call and run the VIT.
 
A couple of other points -
You can get the calling VI's reference by using the Call Chain primitive from the Application Control palette and if you place the VI in the folder of the executable you will have to perform additional strips in an executable. You can recognize this situation by using the Application>>Kind property.

___________________
Try to take over the world!
0 Kudos
Message 5 of 6
(2,577 Views)

I checked  the help document of "Save Instrument Method".  I found the  characteristics of it as following.

Available in Run-Time Engine   No

The save instrument method can't work.

 

 

0 Kudos
Message 6 of 6
(2,558 Views)