Copy link to clipboard
Copied
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.
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")));
Copy link to clipboard
Copied
Use site search.
Perhaps this is what you need.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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")));
Copy link to clipboard
Copied
Thanks r-bin. It works great.
Copy link to clipboard
Copied
Hi, Where can i get "timeline", "animationClass" and other string names which is refering to which.
Copy link to clipboard
Copied
This can only be said by Photoshop developers.
I get it all empirically.
May be helpful https://community.adobe.com/t5/photoshop/is-there-anyway-to-identify-keyframe-of-timeline-animation-...