This is what SilkTest "appstates" are for. See SilkTest help for instructions.
Appstates do not actually do cleanup after a testcase is done, but, they do what is essentially the same thing -- they cleanup before the next testcase starts running.
This can make you test suite run faster, because you do not need to restart the application for every testcase (only for those where starting the application is part of what the testcase is trying to verify).
There are cases where your script writes files, deletes files, manipulates the registry, etc.
Some thoughts that might give you a direction to go:
All my tests are derived from a TestObject in the include file. This TestObjects has four methods; SetUp() NonBrowserTests() BrowserTests() and CleanUp().
It is during CleanUp that all those messes above need to be undone.
Another method we have used in the past was to use a RestoreMachines() method that was called between each TestCase. It was sort of a "snapshot restoration" that would reset Reg values and restor directories to their original condition. It was a fairly involved process and time-costly, but necessary because our scripts were just merciless to the machines and created conditions that invalidated subsequent testing.
SIlk executes a function called DefaultTestCaseExit when a testcase concludes. This function reports any errors that have occured in the testcase.
If you define TestCaseExit (BOOLEAN bExcept) in your frame, this function will execute each time a testcase concludes. Inside the function, do any cleanup you want and then call DefaultTestCaseExit (bExcept). This will report errors as normal, but allow you to completely customize what happens each time a test ends.
I do exactly the same thing in my code as John said. I have a TestcaseExit function that gets called at the end of every testcase and here I do all the cleanups and also write the results of the testcase to my HTML file.
Just to add I also write the functions ScripExit and TestPlanExit, using these functions I do additional cleanups at the script level and also at the testplan level. And also these functions helps me to write consolidated results to the HTML file at the end of each testscript and then finally at the end of each testplan. I have multiple subplans that I call from a main plan. So this approach is very convinent to do the clenups as well as get the consolidated results at runtime