Which of the 2 scripts doesn't work? Because the first one is not what you asked for, nor is it correct.