Please post code, not pictures of code. That way we can copy and paste in the Script Console and in our answers. Wiki - how to post code on this forum
Also, it's a big help if you resize your windows and / or crop your screengrabs. Look at your first image. 98% of it is white space!