Seriously? It takes to much time to simply put the set editor on the shelf and then
1. click the shelf button
2. click the + or - key
Really?
Oh well if you must have a script. Why not just echo all commands in the script editor and then using the set editor add a selection to a set and then open the script editor and using the code generated you can create your generalized script add. Then do the same thing for the - key.
"If I have seen further it is by standing on the shoulders of giants." Sir Isaac Newton, 1675