Today I learned of two undocumented commands in After Effects’ Scripting which have huge implications. It is well known that not all of After Effects’ features are presented by the ExtendScript API, leading to many limitations, such as the inability to create a layer mask via code. This can be largely overcome with nab’s discovery of two commands (taken from this post):
app.findMenuCommandId(”<GUI command name>“) ;
app.executeCommand(<commandId>);
The use of these should be self explanatory, but their existence begs two questions: firstly why they exist, and secondly why are they undocumented? My guess is that they are an ‘in development’ feature used by Adobe programmers to test the integration of scripting before the API was complete.
Since the API is still incomplete these commands remain very useful
There is a suggestion on the source thread that these command may be unreliable under After Effects CS3, which I am unable to test at this time. This could be down to the reporter trying to directly use the same command code ID’s as reported by After Effects 7.0. Since these numeric ID’s are internal references and probably vary between versions, I would suggest always nesting these commands in conjunction, like so:
app.executeCommand(app.findMenuCommand(”<GUI Command Name>“));