Skip to main content
The_Kitty
Inspiring
October 14, 2022
Question

app.executeCommand: Next Keyframe & Previous Keyframe

  • October 14, 2022
  • 2 replies
  • 359 views

Hi!

I have run command line doing "Next keyfame" and "Previous keyframe" but it doesn't work.

Does anyone have a way to fix it instead of using a "Smart Keyframe Navigator" script?

 

app.executeCommand(2520); // Next Keyframe
app.executeCommand(2519);// Previous Keyframe

 

 

This topic has been closed for replies.

2 replies

Mathias Moehl
Community Expert
Community Expert
October 14, 2022

I would not use menu commands in scripting unless it is really necessary. It is much more reliable to use

nearestKeyIndex and keyTime etc. to find the times of keys and set the comp's time to that value. The menu commands rely on many assumptions, like a comp being active, and don't give helpful error when this is not the case. And they don't work at all, if Ae is running headless.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Mylenium
Legend
October 14, 2022

Those two lines by themselves don't do anything. You need of course to fetch the selected layers/ properties and check the state to contextualize the operation, which is what the script you mention does. Why try to reinvent the wheel?

 

Mylenium

The_Kitty
The_KittyAuthor
Inspiring
October 14, 2022

I tried it and it didn't work even though I selected opacity property

The above code is just that I forgot to delete 1 line