Your post is not related to the Editor so you’re posting in the wrong forum. For scripting questions, you need to use the Scripting forum. Also, please use code-tags and not plain-text when posting code. You can edit your post above to use this.
I’ll move your post.