Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Inability to Select Hold Keyframes via Scripting

Community Beginner ,
Mar 05, 2025 Mar 05, 2025

Environment:

After Effects Version: Beta 25.2.0 (Build 122)

Operating System: MacOS Sequioa 15.1

Scripting Environment: ExtendScript

 

Description:

When attempting to programmatically select hold keyframes via scripting, the After Effects scripting API does not mark these keyframes as selected. This issue persists even when attempting common workarounds such as temporarily converting hold keyframes to linear interpolation, inserting dummy keyframes, or using both methods in combination. As a result, scripts that rely on selecting keyframes (e.g., for batch processing or automated editing tasks) fail to work as expected when hold keyframes are involved.

 

Steps to Reproduce:

1. Create a composition and add a layer with a property (e.g., Position) that has keyframes, including a hold keyframe (especially as the last keyframe).

2. Run a script that deselects all keyframes and then attempts to select specific keyframes using setSelectedAtKey(index, true).

3 .Verify that even after attempting temporary interpolation changes (or inserting a dummy keyframe), the hold keyframe remains unselected.

 

Expected Behavior:

The scripting API should allow hold keyframes to be marked as selected (or provide a reliable mechanism to do so) so that scripts can handle keyframe selection uniformly regardless of interpolation type.

 

Actual Behavior:

Hold keyframes remain unselectable via scripting. Even when workarounds are applied (e.g., temporarily switching to linear interpolation), the keyframe does not appear as selected. An error check that sums selectedKeys.length confirms that hold keyframes are not being included.

 

Impact:

This limitation prevents automated scripts from handling all keyframe types consistently. It forces users to either manually adjust keyframes or develop non-ideal workarounds that may alter the look of the animation (even if temporarily), potentially disrupting production workflows.

 

Request:

Please consider adding functionality to the After Effects scripting API that enables the selection of hold keyframes, or provide a documented method for programmatically handling hold keyframes without altering their interpolation permanently.

This is the script that I have been attempting to use, it selects all other keyframes as expected but fails to select or even throw an error when attempting to select Hold Keyframes.

https://pastebin.com/jvcAmGbr

 

Bug Needs More Info
TOPICS
Scripting , Troubleshooting
247
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Pinned Reply

Adobe Employee , Mar 05, 2025 Mar 05, 2025

Hello @levi_bm,

Thanks for the report. I'm Kevin from Support, one of the moderators here. I'll have to ask for your patience since scripting is rather a specialized talent. I hope a team member, Adobe Expert, or a community member will reply shortly with a solution.  Sorry about the frustration.

 

Thanks,
Kevin

 

Status Needs More Info
Translate
6 Comments
Adobe Employee ,
Mar 05, 2025 Mar 05, 2025

Hello @levi_bm,

Thanks for the report. I'm Kevin from Support, one of the moderators here. I'll have to ask for your patience since scripting is rather a specialized talent. I hope a team member, Adobe Expert, or a community member will reply shortly with a solution.  Sorry about the frustration.

 

Thanks,
Kevin

 

Kevin Monahan - Sr. Community & Engagement Strategist – Pro Video and Audio
Status Needs More Info
Translate
Report
Community Expert ,
Mar 05, 2025 Mar 05, 2025

This works fine for me (where keyframe 5 is a hold keyframe):

var myProp = app.project.activeItem.layer(1).property("Position");
for (var i = 1; i <= myProp.numKeys; i++){
	myProp.setSelectedAtKey(i,false);
}
myProp.setSelectedAtKey(5,true);
Translate
Report
Community Beginner ,
Mar 06, 2025 Mar 06, 2025

Hey Dan,
I'm having trouble trying to implement this, trying to integrate it into my current script is causing it to no longer function at all. Trying to run that snippet itself or with some debugging code (https://pastebin.com/RcuVHDKv) throws an error stating that there are no keyframes even on a project with only a .jpg with 5 total keyframes on the position property.

Translate
Report
Community Beginner ,
Mar 06, 2025 Mar 06, 2025

I will add that this script (https://pastebin.com/fgELXJ4N) output the correct number of keyframes when used on the exact same project and layer.

Translate
Report
Community Expert ,
Mar 06, 2025 Mar 06, 2025

I just tested your code on a comp with a solid with five keyframes, where the last keyframe is a hold keyframe, and it works perfectly for me.

Translate
Report
Community Beginner ,
Mar 06, 2025 Mar 06, 2025
LATEST

You're right, it seems to be something with the project that I was testing in that is causing an issue.
Video Attached: https://drive.google.com/file/d/18Q8GRt879PaLEGQ6wz4v95NR3BIjwJAK/view?usp=sharing

Translate
Report