I am proceeding like this: first I select the hole external edges.
And I make a face out of them:
Then I duplicate the face in the Y axis, and delete the old one (I don't know how to detach the new face from the main object):
Then I extrude again all faces, so to inflate the box by the right amount:
Then I bring the open box to intersect the wall:
Then I make FACE - INTERSECT (BOOLEAN):
Then I merge the exceeding vertexes and assign the new material:
Et voilá: frame in the wall.
I am sure this is a stupidly long and convoluted process and that there's a quick command to do this.
Please tell me it's true.
Edit: a little bit faster.
Take the 4 sides of the window, duplicate and move locally in axis, extrude along normals with negative value, delete faces in excess, then move the 4 polygons back into the wall and do the intersect boolean.
It's a bit faster. Still makes no sense.