• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Add a custom solid to a selected comp in the project panel

New Here ,
Jun 14, 2015 Jun 14, 2015

Copy link to clipboard

Copied

Hi

I cant figure this one out. I really am the phase of learning the wonderfull world of after effect scripting.

I am trying to do a script where i add a custom solid to a selected comp in the project panel. Also do a check to see if a comp is selected.

Here below is my poor attempt.

app.beginUndoGroup("Add solid");

var curItem = app.project.activeItems;

//Check if is a comp is selected

if(curItem == null || !(curItem instanceof CompItem)) {

      alert("Please select a comp");

}else{

alert("You have selected a comp");

curItem.items.addSolid([0.5,0.5,0.5], "My Gray Solid", 1920, 1080, 1.0, 5);

}

app.endUndoGroup();




Please advice...

/HRB

TOPICS
Scripting

Views

620

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 14, 2015 Jun 14, 2015

Copy link to clipboard

Copied

It is

app.project.activeItem

not

app.project.activeItems

and

curItem.layers.addSolid

instead of

curItem.items.addSolid

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 19, 2015 Jun 19, 2015

Copy link to clipboard

Copied

LATEST

Thank you Mathias.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines