Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all 2143 articles
Browse latest View live

use Handbrake to transcode video after render finishes

$
0
0

I'm writing a script that would transcode all my renders after they are rendered. This is the code...

 

//render finished here

var command = "HandBrakeCLI -i /path/to/file/filename.mov -o /path/to/file/filename.mp4";

alert(command);

var response = system.callSystem(command);

alert(response);   //never executed due to AE freezing

alert("done");

 

I am getting a very weird behaviour. The file "filename.mov" is successfully transcoded and placed at the specified location, but after effects freezes and blocks me out completely when it reaches

 

var response = system.callSystem(command);

 

So every time I render and transcode, I need to force quit AE.

 

 

This is the only command I encountered that freezes AE. I'd much appreciate any tips on how to handle this kind of problem. HandbrakeCLI is available here: https://handbrake.fr/downloads2.php

I am running macos Sierra.

 

 

 


Mute AE warning about JSON structure changing?

$
0
0

Hi There,

 

In my script, a JSON object is written to a file that is, itself, imported into AE as footage.  If the structure of the JSON written to the file changes, AE throws a modal warning dialog with the following message:

 

After Effects warning: The structure of the data file for the layer "scores.json" has changed

 

Is there any way to disable that error either via scripting or via AE's preferences?  I tried placing code that writes to the JSON file in between the statements  app.suppressDialogs() and app.endSuppressDialogs() but that did not seem to work.  Is it possible to mute it or possible work-arounds so that if the JSON changes structure that error does NOT display?

 

Thanks!

After effects scripting to automate a process

$
0
0

Hi, I am trying to automate a manual task of copying texts from Excel cells to a text layer on a particular composition in After Effects CC 2018.

Here, I am copying texts only to the layers marked with yellow and which are unlocked. So, there is a filter!

How do I code this filter in  Extendscript toolkit and extend scripting in After Effects?

Could anyone share their insights on how to implement this and a useful scripting resource would be handy?

enterKeySignalsOnChange not works ?

$
0
0

when enterKeySignalsOnChange=true apply to Edittext , the enter key would not call the onChange.

am I wrong ?

Access Master Properties via scripting

$
0
0

Hi all. The addition of essential graphics templates is awesome! But how does one access (get or set) the master properties via extendscript?

I can't find anything in the scripting guide regarding master properties

 

For example, if iI want to nest "TemplateComp", that has a custom property "title" into a new comp and name it "NestedTemplateComp", how would one get or set the its' "title" property via extendscript?

 

Also, are we able to "push" this change to the master comp via extendscript?

 

Thank you very much!

Create a txt file in Extendscript

$
0
0

Hey!

im trying to create a script that creates a txt file but i can't do that...

 

that is the function code:

 

var scriptFolderPath = File($.fileName).path; // the URI of the folder that contains the script file  
var TimerFolderPath = scriptFolderPath + encodeURI("/ProjectTimers_sources"); // the URI of the folder for your script resources  

StartButton.onClick = function(){ 


var JFile = new File(TimerFolderPath + encodeURI("/File.txt"));
var content="That is a text file";
File.write(content);


alert("File created!");
}

and it doesn't creates any file...

why this scheduleTask not work ?

$
0
0
function tebb() {
var xx = 0;
var ccr = app.scheduleTask("checkStatus()", 2000, true);


var checkStatus = function () {
if (xx < 5) {
alert(xx);
xx++;
} else {
app.cancelTask(ccr)
}
}
}
tebb()

 

the above code will not run in AE

 

but without the function tebb(), it works!

 

why is happened?

Treat String to extend script command??

$
0
0

Hi there,

How to treat string as extend script inbuilt command??

 

var string="transform";

var v=app.project.activeItem.layer(1).string.property.value;

alert(v);

 

Thank you


initKeyboardEvent construction

$
0
0

Good day everybody.

I'm learning to write scripts for AE. Now I'm trying to simulate key-press through the script. Unfortunately there is almost no information about initKeyboardEvent operator. Just one paragraph in JavaScript Tools Guide CC without any example. And one unanswered topic here. It seems nobody uses it. Alas.

Can anybody describe how to make it work or may be write some small piece of code as an example?

 

I should be grateful for any advice.

Changing the color of a solid

$
0
0

I have a script that allows me to find a solid and change its color. Right now I am able to create a blue solid and change it to any color I need but if I try to create a solid of a different color and change that one the script is unable to find the solid and change it.

 

This is the particular part of the script that is used to change it

 

            if(curLayerSource instanceof SolidSource && curLayerSource.color == "0,0,1"){

                curLayerSource.color = [1,0,0];

                }

 

The first "0,0,1" is what color the solid is and in the second line, [1,0,0] is what color the solid needs to change to. I can change the color in the second line to anything I want and it will work but if I try to create a solid that is for example, grey and replace the "0,0,1" with "0.800,0.800,0.800" it won't find the grey solid and change it. Any idea what I'm doing wrong? Here is the full script below as well.

 

try{

    //----------------------------------Variables----------------------------------

    var proj = app.project;

    var itemTotal = proj.numItems;

    var solidColor = [1, 0, 0];

    var curItem, curComp, totalComps, totalLayers, curLayer, curLayerIndex, curLayerSource;

    var itemAry = new Array();

 

 

    //----------------------------------Loop through project items----------------------------------

    app.beginUndoGroup("Blue to Red");

    for(var i = 1; i <= itemTotal; i++){

        //item assignment

        curItem = proj.item(i);

        //Check if item is comp

        if(curItem instanceof CompItem){

            itemAry[itemAry.length] = curItem;

            }

        }

   

        totalComps = itemAry.length;

  

    for(var c = 0; c < totalComps; c++){

//--------------------------------------------------------------

 

 

            //----------------------------------Variable assignment----------------------------------

            curComp = itemAry[c];

            totalLayers = curComp.numLayers;

           

            //Loop through layers

            for(var l=1; l<=totalLayers; l++){

                curLayer = curComp.layer(l);

                if (curLayer.source == null) continue;

                curLayerIndex = curLayer.index;

                curLayerSource = curLayer.source.mainSource;

               

              

            //------Check layer, if it is a solid and it's blue, change it to red (Change this to set new color)———

            if(curLayerSource instanceof SolidSource && curLayerSource.color == "0,0,1"){

                curLayerSource.color = [1,0,0];

                }

           

                //Update info panel with progress

                writeLn("Layer " + curLayerIndex.toString() + " updated");

                }

//------------------------------------------------------------------          

        }

    app.endUndoGroup();

 

 

    alert("All Done.");

   

//If an error occurs, catch it and show me

}catch(err){

    alert("Error at line # " + err.line.toString() + "\r" + err.toString());

   

}

Script to make video specific duration

$
0
0

Hello,

 

I'm trying to write an AE script that'll do the following:

 

1) Take a list of files on my computer (hundreds or thousands)

2) Use the stretch tool to change their lengths

3) Maintain the audio pitch after stretching the clips (It would be better if I could shift the pitch to anything that I wanted)

4) Change Time Interpolation to Optical Flow once the clip has been stretched

5) Adjust the audio gain to a standardized level

6) Export the composition to a given file path

7) Delete the composition and file before iterating to the next input file.

 

Here's what my script looks like so far:

 

var p = app.project;

// an array or arrays. each inner array contains an input file, output file and the desired new length for the input file

var clips = [[inputFile_1, outputFile_1, time_1], [inputFile_2, outputFile_2, time_2]];

var clipNum = clips.length;

 

 

for (a=0; a<clipNum; a++) {

       var clipArray = clips[a];

       var inputFile = clipArray[0]

       var outputFile = clipArray[1]

       var time = clipArray[2]

     

       // import the clip file

       var clip = p.importFile(new ImportOptions(new File(inputFile)));

     

       // determine the clips length and by what precentage it should be streched

        var length = clip.duration;

        var rateStrech = time/length * 100;

      

        // make a new compoisition and add the clip to the comp

        // app.project.items.addComp(name, width, height, pixelAspect, duration, frameRate)

        var comp = p.items.addComp(clip.name, clip.width, clip.height, clip.pixelAspect, t3, clip.frameRate);

        comp.layers.add(clip);

        var layer = comp.layer(1);

        layer.stretch = rateStrech;

      

        // Maintain audio pitch

        // Adjust Time Interpolation to Optical Flow

        // Adjust the audio gain to a standardized level

        // Export the composition to outputFile variable

        // Delete the compoisition and inputFile.

    };

 

This works well for importing the file and stretching the time, but I cannot figure out the other pieces. Any help would be appreciated.

 

Thank you.

 

[This post moved from After Effects SDK to After Effects Scripting by Moderator]

Extendscript Toolkit just completely stops working?

$
0
0

Let me preface this by saying it has only begun happening on osx 10.7 and 10.8.   My laptop running 10.6 has never had this issue.

 

So I've had this issue before while freelancing - Periodically, and for reasons that I've been entirely unable to pin down, Extendscript Toolkit (the one that ships with CS6) will for all intents and purposes cease functioning.  I've been thick in editing code when I realize that it pretends to be working, but fails to run the code or even respond to keyboard shortcuts. 

 

Command-R does nothing, Command-C / Command-V do nothing.

 

Hilariously, Command-S does nothing. There are plenty of times where I have to manually drag-select my entire code and right click to copy it out into a different text editor to save my work. 

 

Thankfully, Command-Q still works. 

 

I'm really at a loss here.  In the past I've resorted to running my code via applescript, ft-toolbar, etc etc.  This leaves me working in the dark without access to a debugger.  Nothing spells fun like putting all your debugging info into an alert().  Until I can resolve this issue, I just have to drag my laptop with me when I freelance and use it to write all my code.

 

The only thing that I thought could cause it was 'enable javascript debugger' in the general prefs but that seems to have no effect.

 

---

 

Okay, I went and removed everything from 'startup' and changed some random preferences in EST.  (I always like to sanity check before asking questions on the internet) and LO AND BEHOLD, it seems to be working, after two weeks of not working.

 

I'd still deeply appreciate any and all insight into this issue, as it has already severely taxed my sanity.

 

Andrew

A script to apply an expression to all of the properties of the "Stroke Opacity"

$
0
0

I select the shape layer, run the script, and the script applies one expression for all the properties of "Stroke Opacity". How can this be done? Will you help with the script code?

"This project contains a expression error: error 1 of 1" in After Effect. Help.

$
0
0

"This project contains a expression error: error 1 of 1" in After Effect. Help.

 

rateOfSpeed=1;

clockStartTime = thisComp.layer(“slider”).effect(“Slider Control”)(“Slider”)*60;

 

 

clockTimeNumber = Math.floor(clockStartTime – rateOfSpeed*time);

 

 

function addZero(n) {

if (n<10) return “0” + n else return n;

}

 

 

minutes = Math.floor(clockTimeNumber/60);

seconds = clockTimeNumber%60;

 

 

if (clockStartTime > 0 && time < clockStartTime) {

addZero(minutes) + “:” + addZero(seconds);

} else {“00:00”}

 

 

 

This is the code I'm using to create a timer but there is an error and it dosen't work.

 

 

[This post moved to After Effects Scripting by Moderator]

Scripting Trapcode Particular - Color Over Life

$
0
0

Hi all.  Been awhile.  Hope you've all been well.  I'm trying to accelerate some of my workflows via scripting.  I'm having problems setting the "Color Over Life" parameter.  I have "Set Color" set to Random From Gradient.  I'm trying to script the colors inside Color Over Life in Trapcode Particular.  I tried to create some keyframes and pasted them into a text editor, but when I try to utilize those values, I receive an error:  "This propertyValueType CUSTOM_VALUE has not been implemented". Is it possible to set that value with scripting?  (I commented out my attempts at setting that parameter)

 

var curItem = app.project.activeItem;

var selectedLayers = curItem.selectedLayers;

// define the layer in the loop we're currently looking at

for (i=0; i<selectedLayers.length; i++){  

     var curLayer = curItem.selectedLayers[i];   

     // check if that layer is a footage layer   

     if (curLayer.matchName == "ADBE AV Layer"){         

          // add effect         

          var Part = curLayer.Effects.addProperty("Particular");         

          EmitterType_Sphere = Part.property("Emitter Type").setValue(2);         

          PartSize = Part.property("Size").setValue(20);         

          RandomFromGradient = Part.property("Set Color").setValue(3);           

          //  Part.property("tc Particular-0571").setValue([{"PosB":[0,0,0,1,1],"PosG":[0,1,1,1,0],"PosP":[35,76,86,108,1 57],"PosR":[1,1,0,0,0]}])           

          //  Part.property("Color over Life").setValue({"PosB":[0,0,0,1,1],"PosG":[0,1,1,1,0],"PosP":[0,50,100,150,200],"PosR":[ 1,1,0,0,0]});    

      }

}

 

Thanks for your help, -David Wigforss


How to create a AE plugin which converts fps -> milliseconds?

$
0
0

Hi Community,

 

I'm new here and interested in creating a After Effects plugin which displays me fps to milliseconds.

 

Reason:

Reason why I want something like that is because I'm doing a lot UI animation and interactions and constantly get asked by developers in milliseconds. Ideally I'm looking for a plugin which has some script UI panel so I can place it in my AE workplace. I already created an expression version which is a temporary solution but I would prefer to have it as its own panel.

 

Question:

I'm new to creating a After Effects panel and so far I can't find any tutorials how to do it. I know the basics of javascript / and will hack my way around if thats possible but I'm not by any means a developer.

 

Where can I get started and if you have seen something similar even better.

 

Thank a lot in advance,

Heiko

Run .jsx File From Command Line Windows

$
0
0

Suppose I have an adobe after effects project open.  Is it possible to use the command line on Windows to run a .jsx script that will execute for the currently open instance of after effects?

 

I know this might seem like a strange request, but I'm trying to interface python code with after effects scripting, and if I can somehow get .jsx script code to execute automatically after a Python script finishes, that would be fantastic.

 

If I can run the .jsx script from command line, then I could just have Python make a system call to that file.  But opening a .jsx script with ExtendScript just brings it into the editor and does not execute it on Windows.

 

So perhaps associating the .jsx extension with a different .exe file could do it, but I'm not certain.

 

If it's not possible, then how can I write an After Effects script that runs the Python code and doesn't continue executing until the Python script is completely finished?

Call After Effects JSX (ExtendScript) from Python

$
0
0

Hello,

 

I was wondering if it was possible to call a After Effects ExtendScript from Python?

 

I was wondering if there was a library/wrapper available?

 

Thanks!

Easy Ease Keyframe Temporal Interpolation in AE Scripting

$
0
0

My goal is to apply several keyframes to a property of a layer and then set them all as "Easy Ease": essentially, I'm looking to achieve the exact same effect as doing the following in After Effects:

 

Playing keyframes, without changing their default interpolation (so leaving them as linear)

Selecting all keyframes just placed.

Pressing F9 to apply Easy Ease.

 

I know how to do this when using After Effects manually but not when writing scripts.  I would like to achieve the exactly same effect with After Effects scripting.  I've come close, but I'm not quite there.  For example:

 

master_comp.layer(1).property("Opacity").setInterpolationTypeAtKey(1, KeyframeInterpolationType.BEZIER, KeyframeInterpolationType.BEZIER);

 

Will change the newest pre-existing linear keyframe to Bezier, but it will not apply Easy Ease to it; they are not the same.

 

How can I apply Easy Ease to all the keyframes for a given property of a layer?

Get animation of the paragraph with expressions

$
0
0

Hello. I can easily animate revealing the paragraph ( a few lines of text) vertically from the bottom depending on number of lines, but not sure how can I do it if I need to reveal each line separately ( like venetian blinds effect). The only way I see is to separate paragraph into layers containing 1 line each. But try to find another solution. Will be thankful for any ideas.

Viewing all 2143 articles
Browse latest View live