LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Open vi within vi and close the the last one

Solved!
Go to solution

Hi all

 

I've searched the solution to my problem, but didn't find.

 

Short brief:

I have a VI that uses for authorization, then if all O.K it should open other VI("code-vi") and run it and close itself. 

 

I saw that some people recommended , that it can be done by just putting the "code-vi" in the right place, but when I'm following this method , the authorization VI can't be closed. 

 

the other method I tried is to put a sequence where the first stage is opening the "code-vi" with  "vi server ref" and the second stage is close this VI also with "vi server ref". with this method i'm facing two problems , the first is the fact that all the vi's are within a project , and I want that the "path refernce" would be generic - I can put the folder that holdes all the files in any PC and it would run without redirecting the path. 

The second problem is that I can't find the way to automaticaly run the "code-vi" when it invoked. 

 

which files should I attach if i'm using project ? 

0 Kudos
Message 1 of 11
(4,080 Views)

When you call the new VI, close the current VI's front panel.  Use an Invoke Node (Front Panel->Close).  No need to get references or anything.  Just have the Authorizing VI close itself.


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
0 Kudos
Message 2 of 11
(4,055 Views)

thank's crossrulz

 

"Call the VI" meaning just drag the VI file into the block diagram ? 

 

and how do I know the callling the VI would run before the closing of the current VI.

 

I think I mangaed doing that using sequence but with reference, attached. 

 

also this auth.vi sits in the project and I want to run it automatically when I double click on it in the project explorer , how can I do it ? 

0 Kudos
Message 3 of 11
(4,047 Views)
Solution
Accepted by topic author UdiWeiss

No need for the sequence structure.  The error wires are forcing the order with data flow.

 

There is a VI property to run when opened.  We normally do not set that just because it is a pain when debugging and whatnot.


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 11
(4,039 Views)

thanks

 

oh 

 

sorry but still when I double click on the auth.vi in the project explorer it doesn't run. 

0 Kudos
Message 5 of 11
(4,032 Views)

And it shouldn't do that.

When you click and open a vi from the Project Explorer you want the vi to be in a state where you can edit the vi.

If you want to run the vi, then click on the white arrow or press F5.

0 Kudos
Message 6 of 11
(4,018 Views)

🙂 that's I understand , so from your answer I can't configure it as for a VI that it is not in project -> VI properties , execution. 

0 Kudos
Message 7 of 11
(4,006 Views)

@UdiWeiss wrote:

so from your answer I can't configure it as for a VI that it is not in project -> VI properties , execution. 


I'm not sure what you are trying to say here.  The "Run When Opened" property for the VI doesn't care how the VI was opened, just that it was opened.


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
0 Kudos
Message 8 of 11
(4,001 Views)

Not sure how to implement  your suggestion.

 

I tried to put "This VI" reference and connected it to property node "Run When Open" as you can see in the image. 

 

saved it , closed it, and re opened it by double click on it in the project explorer - still won't run automatically.

0 Kudos
Message 9 of 11
(3,971 Views)

@dkfire wrote:

 

If you want to run the vi, then click on the white arrow or press F5.


What  is F5 supposed to do.. ?! Smiley Indifferent

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