in reply to Locking a script

Try Simple Locking. It is pretty heavy with all of the writing it does, but it works.