Thanks for the help. I had already solved it, however I will take into account your recommendation on the preference of local variables over global.

I attach an image of the corrected script


Attached Files Screenshot_20230512-151708.jpg
Last edited by MarcosAM; 05/12/23 19:18.