NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute code when TestStand is closed

I'm looking for a way to execute a particular sequence code whenever TestStand is closed...

 

Basically all im doing in the code is updating a stationglobal and saving, so i need to do this whenever someone closes teststand, any ideas of how to do this? Could it be anywhere in the sequental model?

 

Thanks.

0 Kudos
Message 1 of 8
(4,322 Views)

Use the FrontEndCallbacks.seq for this. This is a sequence that is called by the Sequence Editor and custom UIs, usually when the TestStand engine is created and destroyed, also when the operator logs in and out. Best practice is to create a copy of  C:\Program Files\National Instruments\TestStand 2010 SP1\Components\Callbacks\FrontEnd\FrontEndCallbacks.seq and put it in  TestStand Public\Components\Callbacks\FrontEnd\, then modify the one in Public.

 

You might consider putting your code in the LoginLogout sequence, the only existing sequence in FrontEndCallbacks.seq. You can experiment with this sequence by logging in and out of TestStand.

 

Another choice is the SequenceFileUnload engine callback for your process model file. It would be called everytime the process model was unloaded, that would include when you shutdown TestStand.

cc

0 Kudos
Message 2 of 8
(4,307 Views)

Thanks for your response. I am currently looking into the possible solutions you've provided... I just want to ask to be sure, what should i use if I only want to affect TestStand behavior only when the user closes TestStand.

 

Basically i don't want to change any generic functionality for opening teststand, and I only want to execute a portion of code only when TestStand is exited completely.

0 Kudos
Message 3 of 8
(4,305 Views)

And one more comment to add...

 

I'm only looking to execute when teststand is closed... I cannot execute whenever someone simply logs off or else my code with throw false data to variables..

0 Kudos
Message 4 of 8
(4,301 Views)

Hi,

 

You're right, both solutions may be fired sometimes when TestStand is not actually shutting down.

 

Where are you getting the data that you want to save to your station globals? When TestStand is shutting down, your data might already be gone in some cases.

cc

 

 

0 Kudos
Message 5 of 8
(4,280 Views)

The only data I actually get from teststand is the UniqueEngineID... The information in StationGlobals is updated according to this variable upon closure of TestStand.

0 Kudos
Message 6 of 8
(4,262 Views)

Ok UniqueEngineID should always be available.

 

Obviously it would be done if you could call your function anytime there's a logout or the process model is unloaded, you might review that requirement. There's a property you could use, ApplicationMgr.IsShuttingDown, I'm not sure how to get a reference to ApplicationMgr from inside an execution. 

 

I'm sorry won't be able to fully respond today. This is something I would review with a TestStand Applications Engineer anyway. So if you want getr done, they would have a recommendation and it would only take 10 min.

cc

0 Kudos
Message 7 of 8
(4,259 Views)

Thanks, this is something else to look into.

 

-Appreciated.

0 Kudos
Message 8 of 8
(4,229 Views)