LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW VI scripting - save generated VI

Solved!
Go to solution

Is it possible to automatically save a generated VI (using LabVIEW VI scripting) under a specific target that is already added to the project?

 

0 Kudos
Message 1 of 7
(4,196 Views)

Yes. The easiest way to do this is to open the VI in the proper context. Both Open VI Ref and New VI have an application input. Use this with an application reference from your specific target to open the VI in the proper context. Then save normally.

 

One way to get the application reference is the following sequence:

  1. Application property: Project.ActiveProject
  2. Project property: Targets
  3. TargetItem property: Name (filter to find correct target)
  4. TargetItem property: Application

There is probably a faster way, but this will work.

Message 2 of 7
(4,162 Views)

It is still not clear to me how to do that from your answer. Could you add a photo of those steps?

 

 

 

0 Kudos
Message 3 of 7
(4,074 Views)
Solution
Accepted by topic author chikenene

I think DFGray is trying to do something like this.  There is also an Invoke Method for the Target Item class to add a file.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 7
(4,054 Views)

I can't save my autogenerated VI...😓

Senkaki_0-1684773102374.png

Can I have some help please?

0 Kudos
Message 5 of 7
(1,058 Views)

@Senkaki wrote:

I can't save my autogenerated VI...😓

 

Can I have some help please?


I would suggest looking at the error you get, but I'm guessing that the error is that you probably need to give the full path to the VI and there's probably already a folder called Tarjetas on your desktop, so LV can't save a VI with that name.

 

Another potential issue is that you might need to create all of the folders in the hierarchy of the path (I didn't check) and there's an OpenG VI which does that (there's also a shipping VI, but that returns an error if the path already exists, so you have to filter for that error).


___________________
Try to take over the world!
Message 6 of 7
(1,029 Views)

Sorry for the late response.

 

For some reason, it wasn't saving the VI if I generate it from a VIT.

I chose to save a pattern VI, copy and paste it, and then modify it before the saving. This way, it doesn't give me any errors.

 

Regards,
JonA

0 Kudos
Message 7 of 7
(640 Views)