Menu Command : New Comp from Selection?

Hi!
I’m writing an automation in which I’d need to create compositions from every footage in a folder, using the command “new comp from selection”, but it doesn’t seem to work.
I understand this menu command thing doesn’t always work, but I guess I’m missing something. Is there a way to make it work?
I’ve made a loop inside a folder, said if it was a footage then the item is selected, and then an action/project/menu command = custom / New Comp from Selection
But when I run the script, every footage is selected but no composition is created…
thanks for the help!!

Hi @Yves !,
You are right, some of the menu commands won’t work but I found a solution for this menu command,
I found it on other AE scripting forum because other users couldn’t get this menu command to work too.

Solution:
before running the menu command you have to make the project panel active and only when it active it will work so we can use this lines that will make the panel not active and then active again to ensure it is active -
app.project.showWindow(false);
app.project.showWindow(true);

you can add this part with the “run javascript code” project action but you will have to enable this option in the advance settings of the automation.

How this automation works -

  1. Create a Boolean variable that represents if the folder item is selected.
  2. Loop over all the items and if an item is both a folder and selected it will save it as an item variable called “Selected Folder Item” and set the Boolean variable to true.
  3. If the Boolean variable is false so message the user that he needs to select a folder.
  4. Loop again over all the items in the project and deselect every item.
  5. Loop over the “selected folder item” inner folder items using the loop “items in project folder” option and if the item is footage, select it, run the JavaScript code that makes the project panel active, run the menu command and deselect all the items in the folder again (so only 1 item will be selected in the next loop cycle).

Download -
New Comp From Selection.json (19.7 KB)

Please let me know if you have more questions,
Alon

Hi Alon!

Thanks a lot it does work perfectly!
Ok I think I have what I need for now… great tool, I’m just beginning with the free version, but I’m sure I’ll buy it soon, I see how much it’ll be useful!

@Yves Great!
let me know if you have more questions in the future.

I recommend buying the professional version only if you need to save a lot of automations or run them with keyboard shortcuts,
The free version might be good enough for your long-term use.

Thanks,
Alon