Descargar El Sistema Operativo Windows 11

I am trying to put together a little script to rename windows en masse based on the room they are in and I noticed both my script and your example above produce a bunch of null outputs.( I noticed this is happening when more than one window is in the same room usually? ) Is there a way around this to be able to get the specific room that corresponds to the window element?