Adding existing AE keyboard shortcuts to actions


Is there a way to add “p” to an action so that I may automate layers showing the position in the timeline?

There is no menu command ID for “show layer position track in timeline”

Thank you!

Hi @david, welcome to the forum!
Currently this is not possible, as you mentioned you need a menu command for this or a way to simulate keyboard input (key press of the letter “p”).
A menu command is not something I can add to the software, but perhaps a keyboard event could be simulated natively in future update.

@david , I will also try to see if I can create a workaround to simulate the keyboard click in the current version to give you a solution.
I will post it here if I manage to do it,
are you using windows or mac?

Hi, thank you for your reply. I am using a mac. There is also a strange issue when using menu command id 3781, create shape layers from text… it only seems to perform on the first text layer in a comp, then halts the automation.

Some menu commands works only on 1 layer at a time and can’t work on multiple layers together, so you have to call the menu command action multiple times, each time on a different layer.

Many of the menu commands works based on the selected layer/keyframe/item/other object and wouldn’t work if many layers selected or a layer that not support this function,
so you will have to select a text layer and only 1 layer, then run the menu command, selected the next text layer, and run the menu command again, and do this for all the layers.

this is an example of running this menu command on all the selected text layers.
(I created comments for the lines)
Download -
selected texts to shapes.json (14.4 KB)

this shouldn’t happen, it should continue the automation, maybe it halts because of a different reason (if you will send me the automation that halts It will be easier to identify this issue).

1 Like

Hi @david , I managed to find a way to trigger a keyboard key press (in your case the letter “p”) natively using a Apple Script on mac and PowerShell on windows.

In Windows the process is match simpler, on a mac there are a few steps you need to follow, also because I am not using mac so I had to figure out how it works.

You can do it with these 6 simple steps:

  1. create “key press” apple script.
  2. export the script as application.
  3. set the security & privacy settings for this application.
  4. import the automation.
  5. set the automation properties.
  6. disable after effects warning for executing a file.
  7. done!

I created a video that shows how to set it up and complete all the steps:
(I am using a mac virtual machine so everything is very laggy and slow on my side)

This is the apple script code:

tell application "System Events"
	tell application process "After Effects"
		set frontmost to true
		tell application "System Events" to keystroke "p"
	end tell
end tell

Download the automation:
key press.json (4.8 KB)

keep in mind that a keyboard key press can happen only in the end of an automation when the application is free, because while an automation is running the application freezes so any mouse or keyboard event cannot affect the software so if you need to add lines to the automation add them before.

Let me know if it worked and if you have any questions,

Amazing, thank you!

Hi Alon, are you able to share the Windows implementation?

@efraser88 Sure, as I said it is very simple on windows,
you need to create a batch file (.bat file that contains a PowerShell code that when run will simulate a key press) -

  1. open notepad.
  2. paste this code -
if "%1" == "" start "" /min "%~f0" IS_MINIMIZED && exit
powershell -Command "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait('p')"

(the first line tells this cmd window to open in minimized mode without taking the focus from the After Effects window, second line runs powershell code to simulate the key press, third line tells it to exit the cmd window)

  1. save this script file with .bat file extension, for example “keyboard shortcut 1.bat”.

I left the creation process for you as it is more safe, downloading a malicious shell script can be very dangerous.

now you need to create an automation that will run this script from automation toolkit -

  1. create a file variable and select the script file you just created (click the folder icon and select the file).
  2. add an action and select the file variable name, and then select open.

    download -
    keyboard shortcut.json (1.9 KB)

the automation is ready!

finally you just have to disable this warning message in the preferences (scripting & expressions) -

let me know if you have more questions

I am having difficulty with applying this automation to all precomps in an active composition. I can get it so that all text layers are selected and deleted, but I am running into trouble with having text layers converted to shapes with the menu id command. Any ideas? Thank you.

Hi @david

The solution for this is to check the “precomps” checkbox so the loop will go over all the layers in all the precomps as well.

You need to run the “Create Shapes from Text” menu command on each text layer in every precomp to convert it to shapes, but menu commands can work only if a layer is selected and its composition is visible and opened in the after effects user interface.

In our case when the loop goes over the precomp layers they are not visible in the user interface because the precomp composition is not the active composition and its panel is closed, to fix this we need to open the precomp in the viewer to make it the active composition and then we can run the menu command.

I created an automation that convert all the text layers in the active composition and its precomps to shape layers and deletes them.

Download - texts to shapes.json (12.2 KB)
(I left a comment for each line with more information)

Please let me know if you have more questions.