CC2017 outputModule.file auto overwrite option

Explorer ,
Apr 08, 2019 Apr 08, 2019

Copy link to clipboard

Copied

I have a script that with one click it automatically sets my comp to render queue and starts to render immediately + remove the item from RQ/close the RQ window after the process...all that is working very fine and I am happy with it.

my problem is quite annoying: I want my script automatically overwrite the output file if it exist without asking me - is there some kind of "switch"in the code to tell the script "yes, overwrite that existing file?"

Here is my code:

var item = app.project.activeItem;

if (item != null)

{

var rq = app.project.renderQueue;

var render = rq.items.add(item);

var settings = {

"Quality":"Draft",

"Resolution":"Half",

"Time Span":"Work Area Only",

"Color Depth":"32 bits per channel"

};

render.setSettings(settings);

render.outputModules[1].applyTemplate("Lossless");

var crop_data = {

"Crop":true,

"Crop Bottom":100,

"Crop Left":100,

"Crop Right":100,

"Crop Top":100

};

render.outputModules[1].setSettings(crop_data);

var folder = app.project.file.parent.fsName;

render.outputModules[1].file = new File(folder + "/" + item.name + " [DRAFT].avi");

rq.render();

render.remove();

rq.showWindow(false);

}

else

{

alert("You have to click inside some active composition timeline first!");

}

TOPICS
Scripting

Views

491

Likes

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

Explorer , Apr 08, 2019 Apr 08, 2019

OK, I have solved it myself like this:

var item = app.project.activeItem;

if (item != null)

{

var rq = app.project.renderQueue;

var render = rq.items.add(item);

var settings = {

"Quality":"Draft",

"Resolution":"Half",

"Time Span":"Work Area Only",

"Color Depth":"32 bits per channel"

};

render.setSettings(settings);

render.outputModules[1].applyTemplate("Lossless");

var crop_data = {

"Crop":true,

"Crop Bottom":100,

"Crop Left":100,

"Crop Right":100,

"Crop Top":100

};

render.outputModules[1].setSettings(crop_data);

var

...

Likes

Translate

Translate
Explorer ,
Apr 08, 2019 Apr 08, 2019

Copy link to clipboard

Copied

OK, I have solved it myself like this:

var item = app.project.activeItem;

if (item != null)

{

var rq = app.project.renderQueue;

var render = rq.items.add(item);

var settings = {

"Quality":"Draft",

"Resolution":"Half",

"Time Span":"Work Area Only",

"Color Depth":"32 bits per channel"

};

render.setSettings(settings);

render.outputModules[1].applyTemplate("Lossless");

var crop_data = {

"Crop":true,

"Crop Bottom":100,

"Crop Left":100,

"Crop Right":100,

"Crop Top":100

};

render.outputModules[1].setSettings(crop_data);

var folder = app.project.file.parent.fsName;

var f = new File(folder + "/" + item.name + " [DRAFT].avi");

render.outputModules[1].file = f;

app.beginSuppressDialogs();

rq.render();

app.endSuppressDialogs(false);

render.remove();

rq.showWindow(false);

}

else

{

alert("You have to click inside some active composition timeline first!");

}

Likes

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 Beginner ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

LATEST

I'd like to say thank you very much for posting the answer.

Likes

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