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

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

New Here ,
Mar 08, 2021 Mar 08, 2021

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
945
Translate
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

People's Champ , 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")));

 

Translate
Adobe
People's Champ ,
Mar 08, 2021 Mar 08, 2021
Translate
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

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?

Translate
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
People's Champ ,
Mar 08, 2021 Mar 08, 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.

Translate
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

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

Translate
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
People's Champ ,
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")));

 

Translate
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

Thanks r-bin. It works great.

Translate
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

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

Translate
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
People's Champ ,
Mar 29, 2021 Mar 29, 2021
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-...

Translate
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