Skip to main content
New Participant
March 8, 2021
Answered

How can I make a script that return how many Frames the document has?

  • March 8, 2021
  • 1 reply
  • 843 views

Hello, I'm a beginner at working with Photoshop scripts and currently working with animation frames, and I'd like to know if there's a way to make a JavaScript code to get the number of frames that my current document has.

This topic has been closed for replies.
Correct answer r-bin

Hello r-bin. Same issue me too facing with photoshop cc 2019. I am attaching the photoshop file with multi-frames. Kindly look into this and give me the best possible way.

 

Thank you


There is no Video Timeline in your file.

Therefore, you need to change the "timeline" to "animationClass".

 

var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("frameCount"));
r.putClass(stringIDToTypeID("animationClass"));
var ret = executeActionGet(r);

alert(ret.getInteger(stringIDToTypeID("frameCount")));

 

1 reply

Brainiac
March 8, 2021
New Participant
March 9, 2021

Hey, I've tried that code and I can only get it to return 0, do you think you can elaborate on it for a bit?

Brainiac
March 9, 2021

Unfortunately, I have not worked with animation and have a vague idea of it.

Could you provide a low resolution file with any minimal animation for which the script (for 'frameCount') shows zero? I would then be able to see and, perhaps, figure out what the problem is.