Not sure if you meant this to be a scripting question or just an AI question; if the latter you are in the wrong forum. Nonetheless, in practice/theory, you could take all of your objects that you want clipped and group them together. Then create your clipping shape/mask on top of that group and Ctrl+7 (Cmd+7 on a Mac). Your objects below will still be editable. If you want to create a script for this, use the same logic.
Hope this helps.
More info would help.
it depends a lot on how everything is laid out in your document.
it could be quite simple or it could be incredibly complex.
How will the script know which paths are to be clipping paths?
how will the script know which objects are to be clipped by which clipping path?