Hi @sen93, welcome to the forum!
Yes, I’ve encountered a similar question from another user, and the solution might work for you as well. The user needed to simulate a key press on the keyboard—in his case, the letter “p.”
Simulating a key press can also solve your problem. By triggering the “Enter” key press right after the Auto-trace window appears, you can automate the entire process without needing to move your mouse.
Here’s the older post that might help: Adding existing AE keyboard shortcuts to actions
This post details methods to trigger a key press natively on both Mac and Windows, using AppleScript on Mac and PowerShell on Windows.
In your case, you will need to run a Windows batch script before executing the menu command.
Why should you run the Windows script to trigger the “Enter” key before opening the Auto-trace window?
If you run the menu command first and then the script to trigger the key press, the script won’t execute until you manually close the Auto-trace window. This is because the automation stops and waits for the menu command to resolve before continuing.
The solution is to run the Windows batch script with a small delay—set it to 1 second before it triggers the “Enter” key press. Then, execute the menu command. This delay allows the Auto-trace window to open, and the script will automatically press “Enter” after 1 second, completing the automation smoothly.
Creating the PowerShell script -
You need to create a batch file (.bat file that contains a PowerShell code that when run will simulate a key press) -
- open the notepad software.
- paste this code -
if "%1" == "" start "" /min "%~f0" IS_MINIMIZED && exit
powershell -Command "Start-Sleep -Seconds 1; Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait('{ENTER}')"
exit
(the first line tells this cmd window to open in minimized mode without taking the focus from the After Effects window, second line start a time delay of 1 second and runs powershell code to simulate the key press, third line tells it to exit the cmd window)
- 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.
Instructions on how to use this bat file -
create an automation that will run this script from automation toolkit -
- create a file variable and select the script file you just created (click the folder icon and select the file).
- 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) -
This Automation only execute the (.bat) script that waits 1 second and then press enter so you will not be able to see its effect without adding the menu command after these 2 lines
Here is the automation with the Auto-Trace menu command -
Automatic Auto-Trace.zip (780 Bytes)
(remember that you need to select the (.bat) script file that you created earlier)
Let me know if you need help or have more questions
Thanks,
Alon