July 08th 2014 08:00:02am
Update 8/8/16:
AECC2014_MenuIDs_v2_0.pdf (70+ additions and fixes)
You can get all PDF file via the green buttons to the right.
So for awhile now, many After Effects community members have been using After Effects menu command id’s in their ExtendScript scripts. Some compare the numbers against the text version of a menu command, while other’s are looking to decode what numbers go to which command. This has been a daunting task as there really is no full list, or easy way to obtain all the number’s being used.
To my knowledge at least. Only one pdf list for CS3 posted on Sundstedt Animation exists that I know of. Being the mad man that I am from time to time, I actually hand typed all of the CC menu names out over the last few days, then processed them via a custom script to then pipe them through a loop to acquire each ID number.
So what are these ID’s? Well they basically are a numerical value assigned to a menu command. This value means nothing to the user as they never see these values or never have any need to. They are for running things smoother behind the scenes on the coding end. So say you as a user were to click on “File” > “Preferences” > “General…”. This would take you to a popup of the After Effects preference panel with the “General…” tab selected.
For ExtendScript coders, we can use the assigned ID for “General…” to launch the same panel via scripting. Now there are many conversations talking about the risks of running code like this. The biggest reason, and a very valid one is the stability of it. Sometimes it works, sometimes it can cause issues, or even an application crash.
I personally believe this system was implemented for the AE team to do testing and was never removed from ExtendScript, but that’s purely speculation on my part. Regardless, the option exists and people like to use it. So barring the stability issue, there are other limitations, like duplicate menu names. Now for us to be able to launch a menu command we first get it’s ID via…
app.findMenuCommandId("File...");
The text inside the parenthesis is the menu command name as you see it in the menu drop down. Problem is, if you wanted to launch “Import” > “File…”, there happens to also be “Composition” > “Save Frame As” > “File…”. We can only input the one “File…” and not have any control over which one it is.
The ID only works for one of them, and the only way to find out is to launch and see what happens. In addition this, not all menu commands are available too, some commands don’t have an ID assigned. With each new version of AE, there also brings new ID’s and in some cases the same menu command might have a different ID in each AE version. This particular issue is another reason to be careful using these ID’s in your scripts, just for simple compatibility issues.
It would get convoluted very fast if you wanted your script to be compatible with multiple versions of AE. So enough of the scary, bewares, warnings, and pit falls. Getting the ID’s is a simple task by using that code mentioned above, launching the command is easy as well by using…
app.executeCommand(2544);
The 2544 number is the ID value for the menu command you want to launch. So the value you get from the findMenuCommandId method will go there.
Downloads are available for the AE CC, AE CC 2014, and AE CC 2015 PDF’s I put together. You’ll see a lot of stuff in there, and you most definitely will see a lot of wrong stuff too. Remember the duplicates note I mentioned above. This list was built via automation, to save time. I hand typed the names originally to start the process, but the list and ID’s were done via scripting.
These PDFs are meant more as a starting point for a more complete list, hence the version, date, and time stamp at the top of the pdf. There’s gonna be versioning as things get added/removed. With the help of you and the rest of the AE community members, we can clean this document up over time and get it to a point for it to be very helpful for you and others.