05-03-2017 07:58 AM
I am using TestStand UI to call my sequence and when I exit using the exit menu (see image 1) it will give me this dialog box from TestStand (see image 2).
Now I understand that for TestStand to fully exit, I will need to terminate all the sequence before it can logout and then exit.
What I'm trying to do is either trigger a IEngine.Shutdown or a TerminateAll when someone exits automatically without having the dialog box from TestStand popup.
I've tried handling it from CVI using API calls and from TestStand using Callbacks or GetStates().
From the CVI side, as soon as I exit, it triggers the OnQueryShutdown(); and after bouncing around through UIMessage(), it will then go to OnExitApplication() after all sequence/executions/threads are terminated.
Any help would be appreciated.
05-04-2017 11:56 AM
Hi @b1ack1otus,
I might try using the Exit LabVIEW.vi to close out of the LabVIEW UI when running the TestStand executable. Also, from the CVI side, maybe using a custom UI message might work or a breakpoint. I hope this helps!
05-04-2017 03:59 PM
ExitLabVIEW.vi will not work for this.
If you're using the ApplicationManager control, you should call ApplicationMgr.Shutdown and wait on the ApplicationMgrExitApplication event. If not, you have to take a few passes at Engine.ShutDown
This help doc explains the correct way to shut down the engine:
TestStand Help: Shutting Down the Engine
Let me know if you have questions,
Trent
05-04-2017 05:36 PM
Actually, Looking back at your question - it looks like you're already calling Shutdown.
Do you just want to automatically terminate instead of show that dialog?
05-08-2017 07:54 AM
Hey WireWeaver,
Sorry for the late reply, but yes. I basically want to just suppress the dialog box and always select yes.
05-09-2017 03:41 PM
"Currently there is no exported method or property in the TestStand API that closes the sequence editor programmatically. Instead of using the sequence editor to execute sequences, you can create your own operator interface and implement a programmatic shutdown of it."
http://digital.ni.com/public.nsf/allkb/2892FED93FC0D4EA86256C2F008360D4
05-09-2017 04:16 PM
I don't think that link is strictly correct. You could probably do something like:
Runstate.Engine.GetInternalOption(InternalOption_ApplicationMgr).GetCommand(CommandKind_Exit, 0).Execute(false).
A caveat being that you need to be in a non-execution thread because trying to exit while an execution is running triggers a prompt.
05-12-2017 07:47 AM
I will try to call that function outside of the non-execution thread.
I suppose there's no definitive way to automatically select the "YES" option on the prompt.