I don't have an immediate answer to your question, but I do have another question.
Are you using SQL Enterprise Edition? If so, you might want to look at Change Data Capture. It should be able to handle what you're trying to accomplish in these scripts.
I realize it would be a major change from what you're doing now. But it might be worth it.