Convert layer to Editable Text with AE Script
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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"));
}
}
Copy link to clipboard
Copied
That is perfect. Thank you for your help!
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Wow. This works perfectly. Thank you!

