I think the code is this:
while([equal(getoverlay(0),[-1])],[removeoverlay(getoverlay(0))])
Try putting up some overlays and then using the console/web interface console to type it in and see if it works. I will try and test it later.
To assign it to a key, type:
setinfo([key/VK_F9+],[while([equal(getoverlay(0),[-1])],[removeoverlay(getoverlay(0))])])
VK_F9 is the F9 key - have a look at the file R4\menu\keys.txt for a list of all the keys