@rootJun 04.2018 — #When requesting help, you need to post any code you are having problems with.
In your case, this seems to be a case of a request for code, you will either have to have a go and seek assistance in the forum or go to the part of this sit where you can get people to tender for the job of writing the routine for you.