Rhino script executes correctly but not as background process

I would approach it from another direction, that is how to find objects inside a volume (geometrically) without having to have anything showing on the screen. That is what the script does in the other thread you posted on a similar subject…

One cheap (script-wise) method is to mesh each object and check each mesh vertex if it is inside the volume; if one is found that isn’t, remove the object from the selection and go to the next one. It may be computationally expensive with large numbers of objects.