Single script to select different things

 From:  Flowgun
11127.9 In reply to 11127.8 
Hello Michael,
Sorry for the late.
Here's an example file with a breakdown of the cases.

case 1:
selection: a single box or a surface that are a part of a named collection
wanted behavior: select its naked edges/boundaries
Desired result: it selects the next named objects on the list

case 2:
selection: a couple of boxes that are a part of the same named collection
wanted behavior: select the rest of that same collection (the remaining box)
Desired result: it selects the next named collection in the list. I want this behavior either when nothing is selected, or all the elements of the collection are selected (indicated by the full moon icon)

case 3:
Selection: Edit points on a curve or multiple curves(with whatever else selected - should be checked first?)
wanted behavior: the rest of edit points on the same curve(s) are added to whatever else is selected.
Desired result: Edit points are not added to selection, but the curves are. if I also have a box selected, it defaults to "case 2".
Why: it's sometimes faster and easier to deselect some edit points when all are selected than to have to click
them one by one.

What works as I want:
- selecting a named curve (ex: the S-shaped curves) should be processed by the "named objects". I guess if someone names the curves, he'd want to get them specifically.
- selecting an unnamed curve (ex: a circle) selects all the rest of curves
- selecting edges selects the "edge loop".
- selecting a face selects its boundaries.
Attachments: