Photoshop has not always done a good job with cleaning up these temp files,
especially if PS crashes (which is not an uncommon for me).
The simplest thing is to try do delete all of them when PS starts up. The
remove() call will fail for the current temp file(s), but you do have to know
where they're located to do the getFiles() call.
And if you want to shutdown, photoshop at the end of your script, do this:
photoshop.quit();
For a more elaborate solution, you could send bit of script to Bridge to
shutdown PS, remove all of the temp files and restart PS. I've written several
fault-tolerant scripts that would restart PS multiple times when processing
thousands of images over the course 12-48 hours, so this technique does work.
> If I (user "A") am bumped out due to an application crash and someone else (user "B") logs in will it still delete the scratch file upon Photoshop launch?
From what I have seen in the past, the temp files are deleted as a part of
normal PS shutdown, not during startup. I've had several temp files of different
ages laying around long after they were needed.
-X