I recently uploaded a little script command, which I did some time ago, it should do what you are looking for, but requires DO 11.
I recently uploaded a little script command, which I did some time ago, it should do what you are looking for, but requires DO 11.