It looks like it "should" work, but of course you could also enumerate the PS objects or create a selection set of all viewport objects in paperspace. One thing that may be at issue is irregular shape viewports. Programmatically, they are viewports masked by closed polygons or circles, and may not be recognized.