Post #43 of this thread has an attachment with the script.