08-24-2012 02:18 PM
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.
08-26-2012 12:16 PM
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
08-26-2012 02:09 PM - edited 08-26-2012 02:11 PM
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.
08-26-2012 02:39 PM
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..
08-27-2012 03:32 PM
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
08-29-2012 11:55 AM
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.
08-29-2012 12:30 PM
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
09-04-2012 08:24 AM
Thanks, this is something else to look into.
-Appreciated.