Are you telling us something or asking for help?
It sounds like you are asking for someone to give you a ready made script.
This approach will not teach you anything and if anything doesn't work as expected, you will not know where to look for the problem.