JS script stopped to work after upgrade to Premiere PRO 2020

Community Beginner ,
Jul 27, 2020

Copy link to clipboard

Copied

Hi!

We have some custom scripts that speed up our pipeline. One of them do not work in Premiere 2020. It works perfect in previous versions of Premiere. What may be the reason? The window of script appears, it starts to work, but the main part - export of files do not occur. Here is the part of code:

function export_by_upper_track()
{
var proj = app.project;
message='export_by_upper_track';
app.setSDKEventMessage(message, 'info');
ver=app.version.substring(0,2);
//message="%USERPROFILE%"+"\\Documents\\Adobe\\Adobe Media Encoder\\"+ver+".0\\Presets"

epr_path=$.getenv('USERPROFILE')+"\\Documents\\Adobe\\Adobe Media Encoder\\"+ver+".0\\Presets\\prof.epr"
app.setSDKEventMessage(epr_path, 'info');


if (!app.project.rootItem) return "rootItem is not available";
{
var activeSequence = app.project.activeSequence;
if (activeSequence) {
var foundTarget = false;
var vTrack = activeSequence.videoTracks[activeSequence.videoTracks.numTracks-1];
}
clips=vTrack.clips.numItems
message='clips'+clips;
app.setSDKEventMessage(message, 'info');
outPreset = new File(epr_path);
var format_ext=activeSequence.getExportFileExtension(outPreset.fsName);

message='ext='+format_ext;
app.setSDKEventMessage(message, 'info');

var outputPath = Folder.selectDialog("Choose the output directory");

// The code works OK up to this line - then nothing happened, the value of var clip is correct


for (var i = 0; i < clips; i++) {
start=vTrack.clips[i].start;
end=vTrack.clips[i].end;
message=start;
app.setSDKEventMessage(message, 'info');
message=end;
app.setSDKEventMessage(message, 'info');
activeSequence.setInPoint(start);
activeSequence.setOutPoint(end);
name=outputPath.fsName+"\\"+vTrack.clips[i].name+"."+format_ext;
message=name;
app.setSDKEventMessage(message, 'info');
activeSequence.exportAsMediaDirect(name, epr_path, app.encoder.ENCODE_IN_TO_OUT)
}

}
}

TOPICS
Error or problem, SDK

Views

180

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Community Beginner , Jul 28, 2020
fgups47637040 Community Beginner , Jul 28, 2020
Yes, it works:app.enableQE(); ///qe.setDebugDatabaseEntry("ScriptLayerPPro.EnableNewWorld", "false"); //Great! 

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Employee ,
Jul 27, 2020

Copy link to clipboard

Copied

If you try the same function calls with New World OFF, do they work correctly? 

If so, I think you've run into DVAPR-4225070: "Cannot adjust in point / out point of a trackItem, with New World ON".

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Jul 27, 2020

Copy link to clipboard

Copied

I'll try tomorrow! THank you!

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Jul 28, 2020

Copy link to clipboard

Copied

Yes, it works:

app.enableQE(); ///
qe.setDebugDatabaseEntry("ScriptLayerPPro.EnableNewWorld", "false"); //

Great!

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Jan 29, 2021

Copy link to clipboard

Copied

After the rescent Premiere update another part of script stopped to work with "Object is invalid" message at the:

for (var i = 0; i < clips; i++) {
var clip_qe = qe.project.getActiveSequence().getVideoTrackAt(tr).getItemAt(i);
if(clip_qe.type=="Clip"){
clip_qe.addVideoEffect(qe.project.getVideoEffectByName("Clip Name"));
clip_qe.addVideoEffect(qe.project.getVideoEffectByName("Timecode"));
}
else
{
clips=clips+1;
}
}

Any further steps to get back it work???

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Employee ,
Jan 29, 2021

Copy link to clipboard

Copied

In what previous PPro version, did that code work correctly? 

Also, I see you never check return values before using them; that makes it very hard to tell which part(s) of the compound statements, are failing. 

Which function, above, generates the "object is invalid" message?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Jan 29, 2021

Copy link to clipboard

Copied

You are true - it is the a part of the dumb code.

 

clip_qe.type - generates "invalid object" error.

Of cause variables "i" and "tr" have correct values.

 

Adobe Premiere version 14.3.1. The original Premiere 2020 worked with this code with no problems. 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Feb 01, 2021

Copy link to clipboard

Copied

Well, looks like "mystic" bug:

The other PC with the same script, the same project, Premiere 14.8.0 works peprfect.

But at this installation 
var clip_qe = qe.project.getActiveSequence().getVideoTrackAt(tr).getItemAt(i);

result is "Invalid object".

I have now idea the reason...

 

 

Thanks

 

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Employee ,
Feb 01, 2021

Copy link to clipboard

Copied

First suspect = maybe there isn't an active sequence...?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Feb 01, 2021

Copy link to clipboard

Copied

There is active. I  expand call to the:

var qe_seq = qe.project.getActiveSequence();
var qe_tr = qe_seq.getVideoTrackAt(tr);
var clip_qe = qe_tr.getItemAt(i);

And only last call results in the "Invalid object". All the previous have correct values.

Even with hardcoded "tr" and "i" (=1, or somewhat other reasonable) the same result - "invalid object"

🙂

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Employee ,
Feb 01, 2021

Copy link to clipboard

Copied

This works, here. Does it work for you?

0 New project.

1 Import valid media.

2 Add media to sequence.

3 Delete all empty tracks in sequence. 

4 Make sequence active.

5 Invoke this script.

Result :Works fine, gets name of video clip. 

app.enableQE();
var qe_seq = qe.project.getActiveSequence();
if (qe_seq){
	var qe_tr = qe_seq.getVideoTrackAt(0);
	if (qe_tr){
		var clip_qe = qe_tr.getItemAt(0);
		if (clip_qe){
			var name = clip_qe.name;
		}
	}
}

 

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Feb 01, 2021

Copy link to clipboard

Copied

Hi!

I made more tests. 
With: 

qe.setDebugDatabaseEntry("ScriptLayerPPro.EnableNewWorld", "true"); //

the code works pefect.

( but doesn't work another script that makes export)

With:

qe.setDebugDatabaseEntry("ScriptLayerPPro.EnableNewWorld", "false"); //

the code results in error with invalid object.

Now I have no idea how to make it works simultaneously.

🙂

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Employee ,
Feb 02, 2021

Copy link to clipboard

Copied

Why would you like to turn off New World?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Feb 02, 2021

Copy link to clipboard

Copied

Hi!

I have set if Premiere scripts. Some of them rename files and make specific watermark for clips, other - export files.

At the start of this thread - was my question - as my export scripts stopped to work, only turning off New World helped to get it work back.

 

 

10x

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Employee ,
Feb 02, 2021

Copy link to clipboard

Copied

Let's dig into the specifics of why those scripts fail in New World. Perhaps send them directly to me, and indicate which specific calls fail? mailto:bbb@adobe.com

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Feb 02, 2021

Copy link to clipboard

Copied

I'll make test tomorow - as there is a critical process on PC with "test environment".

Nice to have such kind of support from Adobe 🙂

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Feb 06, 2021

Copy link to clipboard

Copied

well, I got some time and make code revision.

Some API calls required update - but now it looks to work in "NewWorld".  As I do not need back compatibility - one can think that the problem is solved 🙂

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more