As far as I know you cannot construct a script to give itself
permission. This would be the same as giving a user the permissions at user
level because they could just write a script to do what they want to do and
give the script permissions.
What I would recommend is getting a service account or an admin account
to run the script through a scheduler if it is a repeated task.