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

Array.prototype functions undefined in After Effects scripts?

New Here ,
Aug 17, 2021 Aug 17, 2021

Copy link to clipboard

Copied

So, a script I was developing was working fine yesterday, but today, it seems like my Array built-in object is broken. I tried restarting After Effects to reset the environment, but it's still broken. So far, I've identified that "map", "includes", and "split" are broken, though "shift" is fine. I don't have any custom startup scripts.

 

I've attached a simple .txt file that demonstrates this error for me, though I'm guessing it would work normally. Just rename it to .jsx and run it yourself.

 

OS: MacOS Big Sur v11.4

AE: v18.4.0 build 41

TOPICS
Error or problem , Scripting

Views

746

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 ,
Aug 17, 2021 Aug 17, 2021

Copy link to clipboard

Copied

EDIT:

Whoops, "split" is a string function, it won't work anyway, ahahah.

Still, "map" and "includes" are both broken for me.

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
Community Expert ,
Aug 18, 2021 Aug 18, 2021

Copy link to clipboard

Copied

In general, you cannot expect Ae scripting to support all features of modern JavaScript.

After Effects scripting is using ExtendScript and ExtendScript implements the JavaScript language according to the ECMA-262 specification. This is a very old variant of JavaScript and it does not include features like Array.map, yet.

 

 

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

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
Community Expert ,
Aug 18, 2021 Aug 18, 2021

Copy link to clipboard

Copied

LATEST

The worst difference I found so far is actually this one:

true || true && false

evaluates to "false" in After Effects ExtendScript, but to "true" in modern JavaScript.

Because After Effects reads it as

(true || true) && false

whereas modern JavaScript reads it as

true || (true && false)

 

So when writing logic statements, make sure to always set parenthesis to avoid trouble. And don't use minifiers like uglify.js which remove these parenthesis.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

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