You've still hidden most aspects in your new thread, and posted it elsewhere too.
I dislike writing code when it's all made up - what happens is what you've already seen, the volunteer has to re-write the code again.
If the question is simple and no effort is needed then I'll offer a suggestion - but if it's complex then more work is needed to give a solution, and in the same way even more work is needed to re-write *that* script when some other aspect turns out to be important, and was hidden.
It may not seem such a horrible thing - but when it's happened for the ten thousandth time, it gets a bit irritating.