Exit a Script
Is there any way to kick off code when a user hits the Stop Script button while debugging ? Something like an onExit event for a script. I need to run code when a tester doesn't complete a script.
Re: Exit a Script
You can use the script_AfterRun event as follows for normal script termination.
Private Sub Script_AfterRun()
'Insert code here
This will run following the normal completion of the script, but will not run if a user stops debugging which is what you asked for. I do not believe there is any way to execute code when you stop the debugger. What you might want to try doing is running your cleanup code at the start of each script in case it does not get cleaned up on a previous run. You could set a completion flag file somewhere that gets set during normal script completion.