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

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 , Windows

Views

470

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

Valorous Hero , 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")));

 

Votes

Translate

Translate
Adobe
Valorous Hero ,
Mar 08, 2021 Mar 08, 2021

Copy link to clipboard

Copied

Votes

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?

Votes

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
Valorous Hero ,
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.

Votes

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

Votes

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
Valorous Hero ,
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")));

 

Votes

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.

Votes

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.

Votes

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
Valorous Hero ,
Mar 29, 2021 Mar 29, 2021

Copy link to clipboard

Copied

LATEST

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

Votes

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