LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview does not quit when called from command line

Dear community,

 

I'd like to run a utility vi which is located inside a project from command line. After it run I'd like to terminate Labview and continue with my command line script. Since it is a utility vi, I don't want to generate an .exe from it, since that would mean much overhead. 

 

Here is what I tried, this is inside my example_utility.vi:

maxine_mumann_0-1679656719030.png

This perfectly terminates the vi as well as Labview, when running directly from the project.

 

However when I open Labview from command line,

$ "LabVIEW.exe" "myProject.lvproj" "example_utility.vi"

the vi runs (as configured upon opening) and terminates but Labview remains open.

 

Do you have any idea how to quit Labview after the vi finished? Is it possible to call "Quit Labview" Node from command line? I am also open for ideas how to perform these steps from a python script, if there are more convenient possibilies.

 

My local machine has Windows 10 and I am using Labview2022Q3.

Looking forward to your advice,

best wishes

  

 

0 Kudos
Message 1 of 10
(1,563 Views)

Hi maxine,

 


@maxine_mumann wrote:

Since it is a utility vi, I don't want to generate an .exe from it, since that would mean much overhead. 


What exactly is the overhead in creating an executable from your VI(s)?

It seems less troublesome than starting/quitting LabVIEW each time you want to call this functionality within your batch file…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(1,547 Views)

Dear GerdW, 

 

thanks for your fast response. There are several of these utility.vi s in different labview projects and I would like to run them upon request.

 

We are some collaborating developers and when any utility.vi changes it would need a re-build of the respective .exe. Each utility vi needs a build specification, which in best case detects that a modification was done and triggers a re-build. Further this .exe needs to be deployed somewhere and fetched from the command line script. This seems to me quite some overhead.

 

Best wishes

 

 

0 Kudos
Message 3 of 10
(1,526 Views)

Hi Maxine,

 


@maxine_mumann wrote:
  1. We are some collaborating developers and when any utility.vi changes it would need a re-build of the respective .exe.
  2. Each utility vi needs a build specification, which in best case detects that a modification was done and triggers a re-build.
  3. Further this .exe needs to be deployed somewhere and fetched from the command line script. This seems to me quite some overhead.

  1. Yes, changes to source code require building a new exe version. But that's one (more) item on the checklist for distributing software…
  2. Yes, creating an exe requires a build spec, but that's a one-time work item. (There are also CI/CD approaches with LabVIEW, but I don't have any experience with that.)
  3. When you work with a team of developers you surely use some SCC tool. So "deploying" reduces to updating local code base. But you need to deploy the changed VI anyway, so what's the problem with "updating" a folder?

I still don't see the overhead (apart from running a pre-defined build spec)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 10
(1,513 Views)

Hello GerdW,

 

thank you for your response. We have quite some difficulties to maintain this project, up to now we did not find a sufficticated way to maintain our project in terms of Package Manager or instant fetching dependencies. However, this is another question. I appreciate your advice to take another approach to complete the task, but it really seems too much overload for this project. 

 

There is still the question left, why Labview VI 'Exit Labview" does not exit Labview, when the project and vi was started via command line? Do you know why that is and how to fix it?

 

Looking forward to your response. Best wishes

0 Kudos
Message 5 of 10
(1,433 Views)

Did you ever get an answer?  I've got something very similar going on.

 

joshualguthrie2civ_0-1768322112585.png

joshualguthrie2civ_1-1768322132507.png

joshualguthrie2civ_2-1768322142422.png

The VI never finishes.  I don't want to throw the nuclear "Quit LabVIEW" vi, as I will likely have other VIs running.

 

The next time i execute it, nothing happens, as if the orignial is still going...  

joshualguthrie2civ_3-1768322176525.png

 

 

Am I missing an INI setting or something?

0 Kudos
Message 6 of 10
(107 Views)

Even though the front panel is hidden, it is still open. Try closing it programmatically as the last thing the VI does. I think that setting the front panel to "hidden" opens the front panel explicitly so you have to close it explicitly.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 7 of 10
(94 Views)

What Bill said should work AND there is an easier way.

 

I highly recommend using G-CLI or LabVIEW-CLI (if you can't install vipm packages). It's designed specifically to call LV code from the CLI.

 

https://www.vipm.io/package/wiresmith_technology_lib_g_cli/

https://labviewwiki.org/wiki/NI_LabVIEW_Command_Line_Interface

 

Upthread someone mentioned building exes and that is also good but not always possible. Sometimes want things that are only accessible in the IDE.

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 8 of 10
(85 Views)

oh and if you use either of those you'll probably want this package too. As they set the unattended flag which can cause some weird behaviour like file dialogs just simply not showing up.

 

https://www.vipm.io/package/felipefoz_lib_enable_lv_dialogs/

 

If you encountered weird behaviour with file dialogs, just run this from the tools menu and try again.

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 9 of 10
(82 Views)

That did it.

I changed the call to,

joshualguthrie2civ_0-1768332658535.png

as you mentioned.  It didn't like being run hidden.  I then just called a vanilla 

 

joshualguthrie2civ_3-1768333000883.png

 

And that took care of it.

 

Thanks again.  I've always had the devil running VIs in Hidden state.. and your explanation makes perfect sense.

0 Kudos
Message 10 of 10
(71 Views)