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

Convert layer to Editable Text with AE Script

Community Beginner ,
May 19, 2014 May 19, 2014

I'm currently learning how to use Extend Script and would like to know if it is possible to perform the "Convert to Editable Text" command on a layer via Extend Script?

I can seem to find any information regarding this in the After Effects Scripting Guide.

Thanks!

TOPICS
Scripting
1.1K
Translate
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
Enthusiast ,
May 19, 2014 May 19, 2014

You can use the app.executeCommand(app.findMenuCommandId("exact text of menu item")) to access functionality that isn't otherwise accessible through scripting. But as it's the equivalent to choosing the menu item manually you need to ensure the state of the project (i.e. comp is open, correct layers are selected) is suitable for that menu option.

var activeItem = app.project.activeItem;

if (activeItem != null && activeItem instanceof CompItem) {

  if (activeItem.selectedLayers.length > 0) {     // ensure at least one layer is selected

  activeItem.openInViewer(); // ensure comp is open and active

  app.executeCommand(app.findMenuCommandId("Convert to Editable Text"));

  }

}

Translate
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 Beginner ,
May 19, 2014 May 19, 2014

That is perfect. Thank you for your help!

Translate
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 Beginner ,
Jun 15, 2014 Jun 15, 2014

Is it possible to control what layer the command is applied to? I understand the selectedLayers attribute is read-only. But is there any work-around?

Translate
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 15, 2014 Jun 15, 2014

One way would be to loop through all the layers in the comp and make sure they're all deselected:

for (var i = 1 ; i <= myComp.numLayers; i++) myComp.layer(i).selected = false;

and then select the ones you want:

myTextLayer.selected = true;

Dan

Translate
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 Beginner ,
Jun 15, 2014 Jun 15, 2014
LATEST

Wow. This works perfectly. Thank you!

Translate
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