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

New Here ,
Mar 08, 2021 Mar 08, 2021

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.

TOPICS
Actions and scripting, How to, Make It, Windows

Views

151

Likes

translate

Translate

Translate

Report

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 Correct Answer

Adobe Community Professional , Mar 20, 2021 Mar 20, 2021
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")));  

Likes

translate

Translate

Translate
Adobe Community Professional ,
Mar 08, 2021 Mar 08, 2021

Copy link to clipboard

Copied

Likes

translate

Translate

Translate

Report

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
New Here ,
Mar 08, 2021 Mar 08, 2021

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?

Likes

translate

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 08, 2021 Mar 08, 2021

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.

Likes

translate

Translate

Translate

Report

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
Explorer ,
Mar 20, 2021 Mar 20, 2021

Copy link to clipboard

Copied

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

Likes

translate

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 20, 2021 Mar 20, 2021

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")));

 

Likes

translate

Translate

Translate

Report

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
Explorer ,
Mar 20, 2021 Mar 20, 2021

Copy link to clipboard

Copied

Thanks r-bin. It works great.

Likes

translate

Translate

Translate

Report

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
Explorer ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

Hi, Where can i get "timeline", "animationClass" and other string names which is refering to which.

Likes

translate

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 29, 2021 Mar 29, 2021

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-...

Likes

translate

Translate

Translate

Report

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