Interested to know if this modified version of the script works for you:
If not, here's an idea that might solve the same problem a different way...
For more information, see the wiki Searching the Forum for Answers section.