Okay... ummmm, I think the best way for us and you to understand what's trying to be achieved here is:
- List out exactly what you want to have happen, be very detailed.
- Now, run us and yourself through your script(s) step by step and tell us what each part is going to do and how it's going to do it. Again, be very detailed. Like say what each command's purpose is in your script.
If you can do that, I'm pretty positive that not only will you understand scripting a bit better, but you'll probably find the solution in the process.
FYI, this is how I debug my scripts.
The one and only,
Those who live in the past, are destined to insanity. Those who live only for the future, will be slaves to their ambitions.
Those who live in the moment... only they, are truly happy.