Even if you make it work, the scripted component is a very poor tool. I would say useless vs the real projects generally encountered as it was the case for some "Image Explorer" done in this collab. What about shuffling and select a collection for the next part of the project ? Some scripted components are very useful at times, doing things Mathcad does not do naturally but if they are just band-aid, don't wound Mathcad first !
jmG