Highlighted

Script randomly launches Extend Script Toolkit

Community Beginner ,
May 29, 2019

Copy link to clipboard

Copied

Hi

I have a random error whereby my script runs fine but always additionally launches the Extendscript toolkit. Wondered if someone could have a look through my code and maybe suggest a fix? It's a simple script that automatically generates a guide layer and applies a preset.

var newAdj = this;

    var activeComp = app.project.activeItem;

    if (activeComp instanceof CompItem) {

        var newAdj = activeComp.layers.addSolid([1,1,1], "OCIO", activeComp.width, activeComp.height, activeComp.pixelAspect, activeComp.duration);

        newAdj.label = 5;

        newAdj.adjustmentLayer = true;

        newAdj.guideLayer = true;

}

else {

    alert("Select Comp to apply OCIO.");

}

var main = function() {

  var proj = app.project;

  var presetfilepath = "/C/Program Files/Adobe/Adobe After Effects CC 2018/Support Files/Presets/ocio_apply.ffx"

  var pfile = File(presetfilepath);

  if (pfile.exists !== true) {

    alert('Preset file does not exist');

    return;

  }

  app.beginUndoGroup('apply preset');

  for (var i = 0; i < proj.selection.length; i++) {

    var item = proj.selection;

    if (item instanceof CompItem) {

      var layer = item.layers[1];

      $.writeln(layer.name);

      layer.applyPreset(pfile);

    }

  }

  app.endUndoGroup();

  return 0;

};

var run = function(f) {

  return f();

};

run(main);

Many thanks

You need to comment out or remove the line:

$.writeln(layer.name);

It opens the ESTK so it can write that in the console.

TOPICS
Scripting

Views

224

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

Script randomly launches Extend Script Toolkit

Community Beginner ,
May 29, 2019

Copy link to clipboard

Copied

Hi

I have a random error whereby my script runs fine but always additionally launches the Extendscript toolkit. Wondered if someone could have a look through my code and maybe suggest a fix? It's a simple script that automatically generates a guide layer and applies a preset.

var newAdj = this;

    var activeComp = app.project.activeItem;

    if (activeComp instanceof CompItem) {

        var newAdj = activeComp.layers.addSolid([1,1,1], "OCIO", activeComp.width, activeComp.height, activeComp.pixelAspect, activeComp.duration);

        newAdj.label = 5;

        newAdj.adjustmentLayer = true;

        newAdj.guideLayer = true;

}

else {

    alert("Select Comp to apply OCIO.");

}

var main = function() {

  var proj = app.project;

  var presetfilepath = "/C/Program Files/Adobe/Adobe After Effects CC 2018/Support Files/Presets/ocio_apply.ffx"

  var pfile = File(presetfilepath);

  if (pfile.exists !== true) {

    alert('Preset file does not exist');

    return;

  }

  app.beginUndoGroup('apply preset');

  for (var i = 0; i < proj.selection.length; i++) {

    var item = proj.selection;

    if (item instanceof CompItem) {

      var layer = item.layers[1];

      $.writeln(layer.name);

      layer.applyPreset(pfile);

    }

  }

  app.endUndoGroup();

  return 0;

};

var run = function(f) {

  return f();

};

run(main);

Many thanks

You need to comment out or remove the line:

$.writeln(layer.name);

It opens the ESTK so it can write that in the console.

TOPICS
Scripting

Views

225

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
May 29, 2019 0
Engaged ,
May 29, 2019

Copy link to clipboard

Copied

You need to comment out or remove the line:

$.writeln(layer.name);

It opens the ESTK so it can write that in the console.

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
Reply
Loading...
May 29, 2019 1
Community Beginner ,
May 29, 2019

Copy link to clipboard

Copied

Yes that was it!

Thank you so much Paul - and for a such a quick response. Much appreciated.

Cheers

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
Reply
Loading...
May 29, 2019 0