How to make a rectangular hole

Try this script (bevel after boolean)