Skip to main content
Known Participant
April 19, 2017
Answered

Why is console undefined in com.adobe.PProPanel?

  • April 19, 2017
  • 1 reply
  • 2307 views

If I add a console.log statement to the PProPanel > Premiere.jsx file then when running in PP I get "script error: console is undefined" when I'm using Chrome and viewing on the port defined in the .debug file.

But if I add console.log to this example

https://github.com/ThomasSzabo/Minimalistic-Adobe-Premiere-Pro-Panel

then it works as expected.

Sure I can use $.writeln() and view a log in ExtendScript Toolkit, but why doesn't it work in PProPanel?

This topic has been closed for replies.
Correct answer Thomas_Szabo

Hey Martin,

may I ask where in the example code you're adding a console.log?

All jsx files are living in the ExtendScript context. Please do not confuse ExtendScript with JavaScript. ExtendScript uses JS syntax but is not JS. The console object does not exist in the ExtendScript world - only in JavaScript. So if you added console.log to the index.html, then you're in the HTML context of the Premiere Panel - not ExtendScript.

I hope this helps.

Thomas

1 reply

Thomas_Szabo
Thomas_SzaboCorrect answer
Inspiring
April 19, 2017

Hey Martin,

may I ask where in the example code you're adding a console.log?

All jsx files are living in the ExtendScript context. Please do not confuse ExtendScript with JavaScript. ExtendScript uses JS syntax but is not JS. The console object does not exist in the ExtendScript world - only in JavaScript. So if you added console.log to the index.html, then you're in the HTML context of the Premiere Panel - not ExtendScript.

I hope this helps.

Thomas

Known Participant
April 19, 2017

Thanks Thomas, that makes sense.

jingtaotan
Inspiring
April 26, 2017

In ExtendScript (at least for Premiere), you can use $.writeln() to log messages to the ExtendScript Toolkit's console.

Alternatively, polyfill console.log like so:

var console = console || {};

console.log = function (message) {

    $.writeln(message);

};