// Isosceles_PasteClipboardIntoComps.jsx
// Code generated by ChatGPT-5.5
// Date: June 2, 2026
// Description: This After Effects script will paste the clipboard contents into each comp that is selected in the Project window.
// IMPORTANT NOTE: This has only been tested with pasting a layer (footage, adjustment layer, or solid layer). The was the original use-case.
// IMPORTANT NOTE: I would recommend executing this script only with 100 comps selected at a time. Any more and After Effects will freeze. Not sure why.

{
    app.beginUndoGroup("Paste Clipboard Into Selected Comps");

    var proj = app.project;

    if (!proj) {
        alert("No project open.");
    } else {
        var selection = proj.selection;

        if (selection.length === 0) {
            alert("Please select one or more compositions in the Project panel.");
        } else {

            for (var i = 0; i < selection.length; i++) {

                if (selection[i] instanceof CompItem) {

                    var comp = selection[i];

                    // Open comp in viewer and make it active
                    comp.openInViewer();

                    // Paste clipboard contents into this comp
                    app.executeCommand(20); // Edit > Paste
                }
            }
        }
    }

    app.endUndoGroup();
}